Patch 9.0.1561
Problem: Display wrong when moving cursor to above the top line and
'smoothscroll' is set.
Solution: Call adjust_skipcol() in more places and make it work better.
(Luuk van Baal, closes #12395)
Files: src/move.c, src/textobject.c, src/testdir/test_display.vim,
src/testdir/test_scroll_opt.vim,
src/testdir/dumps/Test_display_cursor_long_line.dump,
src/testdir/dumps/Test_display_cursor_long_line_1.dump,
src/testdir/dumps/Test_display_cursor_long_line_2.dump,
src/testdir/dumps/Test_display_cursor_long_line_3.dump,
src/testdir/dumps/Test_display_cursor_long_line_4.dump
*** ../vim-9.0.1560/src/move.c 2023-05-13 14:12:12.234383092 +0100
--- src/move.c 2023-05-15 18:10:46.238075004 +0100
***************
*** 1960,1971 ****
curwin->w_skipcol -= width2;
else
curwin->w_skipcol -= width1;
- redraw_later(UPD_NOT_VALID);
scrolled = TRUE;
- validate_virtcol();
}
if (scrolled)
return; // don't scroll in the other direction now
int col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols;
int row = 0;
--- 1960,1973 ----
curwin->w_skipcol -= width2;
else
curwin->w_skipcol -= width1;
scrolled = TRUE;
}
if (scrolled)
+ {
+ validate_virtcol();
+ redraw_later(UPD_NOT_VALID);
return; // don't scroll in the other direction now
+ }
int col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols;
int row = 0;
*** ../vim-9.0.1560/src/textobject.c 2022-08-16 20:23:57.398232761 +0100
--- src/textobject.c 2023-05-15 18:10:46.242075005 +0100
***************
*** 472,477 ****
--- 472,478 ----
finished:
stop = FALSE;
}
+ adjust_skipcol();
return OK;
}
***************
*** 598,603 ****
--- 599,605 ----
return OK;
}
}
+ adjust_skipcol();
return OK;
}
*** ../vim-9.0.1560/src/testdir/test_display.vim 2023-05-11 19:23:49.213031292 +0100
--- src/testdir/test_display.vim 2023-05-15 18:10:46.238075004 +0100
***************
*** 507,520 ****
CheckScreendump
let lines =<< trim END
! call setline(1, ['a', 'bbbbb '->repeat(100), 'c'])
norm $j
END
call writefile(lines, 'XdispCursorLongline', 'D')
let buf = RunVimInTerminal('-S XdispCursorLongline', #{rows: 8})
! call VerifyScreenDump(buf, 'Test_display_cursor_long_line', {})
call StopVimInTerminal(buf)
endfunc
--- 507,535 ----
CheckScreendump
let lines =<< trim END
! call setline(1, ['a', 'b ' .. 'bbbbb'->repeat(150), 'c'])
norm $j
END
call writefile(lines, 'XdispCursorLongline', 'D')
let buf = RunVimInTerminal('-S XdispCursorLongline', #{rows: 8})
! call VerifyScreenDump(buf, 'Test_display_cursor_long_line_1', {})
!
! " FIXME: moving the cursor above the topline does not set w_skipcol
! " correctly with cpo+=n and zero scrolloff (curs_columns() extra == 1).
! call term_sendkeys(buf, ":set number cpo+=n scrolloff=0\<CR>")
! call term_sendkeys(buf, '$0')
! call VerifyScreenDump(buf, 'Test_display_cursor_long_line_2', {})
!
! " Going to the start of the line with "b" did not set w_skipcol correctly
! " with 'smoothscroll'.
! call term_sendkeys(buf, ":set smoothscroll\<CR>")
! call term_sendkeys(buf, '$b')
! call VerifyScreenDump(buf, 'Test_display_cursor_long_line_3', {})
! " Same for "ge".
! call term_sendkeys(buf, '$ge')
! call VerifyScreenDump(buf, 'Test_display_cursor_long_line_4', {})
call StopVimInTerminal(buf)
endfunc
*** ../vim-9.0.1560/src/testdir/test_scroll_opt.vim 2023-05-13 14:12:12.234383092 +0100
--- src/testdir/test_scroll_opt.vim 2023-05-15 18:10:46.242075005 +0100
***************
*** 502,508 ****
" regardless of number and cpo-=n.
setl number list listchars=precedes:< cpo-=n
call s:check_col_calc(5, 1, 1)
! exe "normal 2|\<C-E>"
call s:check_col_calc(6, 1, 18)
norm h
call s:check_col_calc(5, 2, 17)
--- 502,508 ----
" regardless of number and cpo-=n.
setl number list listchars=precedes:< cpo-=n
call s:check_col_calc(5, 1, 1)
! exe "normal 3|\<C-E>h"
call s:check_col_calc(6, 1, 18)
norm h
call s:check_col_calc(5, 2, 17)
*** ../vim-9.0.1560/src/testdir/dumps/Test_display_cursor_long_line.dump 2023-05-11 18:37:57.441591098 +0100
--- src/testdir/dumps/Test_display_cursor_long_line.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,8 ****
- |<+0#4040ff13#ffffff0@2|b+0#0000000&@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4|
- |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@2
- @2| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4|
- |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@2
- @2| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4|
- |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@2
- @2| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4| |b@4>
- @57|2|,|6|0@1| @8|5|0|%|
--- 0 ----
*** ../vim-9.0.1560/src/testdir/dumps/Test_display_cursor_long_line_1.dump 2023-05-15 18:17:08.910329355 +0100
--- src/testdir/dumps/Test_display_cursor_long_line_1.dump 2023-05-15 18:10:46.238075004 +0100
***************
*** 0 ****
--- 1,8 ----
+ |<+0#4040ff13#ffffff0@2|b+0#0000000&@71
+ @75
+ @75
+ @75
+ @75
+ @75
+ @1>b| @72
+ @57|2|,|7|5|2| @8|5|0|%|
*** ../vim-9.0.1560/src/testdir/dumps/Test_display_cursor_long_line_2.dump 2023-05-15 18:17:08.918329361 +0100
--- src/testdir/dumps/Test_display_cursor_long_line_2.dump 2023-05-15 18:10:46.238075004 +0100
***************
*** 0 ****
--- 1,8 ----
+ |<+0#4040ff13#ffffff0@2|b+0#0000000&>b@70
+ @75
+ @75
+ @75
+ @75
+ @75
+ @75
+ | @56|2|,|1| @10|5|0|%|
*** ../vim-9.0.1560/src/testdir/dumps/Test_display_cursor_long_line_3.dump 2023-05-15 18:17:08.922329362 +0100
--- src/testdir/dumps/Test_display_cursor_long_line_3.dump 2023-05-15 18:10:46.238075004 +0100
***************
*** 0 ****
--- 1,8 ----
+ | +0#af5f00255#ffffff0@1|2| |b+0#0000000&| >b@68
+ @75
+ @75
+ @75
+ @75
+ @75
+ @75
+ | @56|2|,|3| @10|5|0|%|
*** ../vim-9.0.1560/src/testdir/dumps/Test_display_cursor_long_line_4.dump 2023-05-15 18:17:08.926329366 +0100
--- src/testdir/dumps/Test_display_cursor_long_line_4.dump 2023-05-15 18:10:46.238075004 +0100
***************
*** 0 ****
--- 1,8 ----
+ | +0#af5f00255#ffffff0@1|2| >b+0#0000000&| |b@68
+ @75
+ @75
+ @75
+ @75
+ @75
+ @75
+ | @56|2|,|1| @10|5|0|%|
*** ../vim-9.0.1560/src/version.c 2023-05-15 16:41:36.796057692 +0100
--- src/version.c 2023-05-15 18:12:45.462158976 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1561,
/**/
--
hundred-and-one symptoms of being an internet addict:
37. You start looking for hot HTML addresses in public restrooms.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///