Skip to content

Commit

Permalink
patch 9.1.0708: Recursive window update does not account for reset sk…
Browse files Browse the repository at this point in the history
…ipcol

Problem:  Window is updated with potentially invalid skipcol in recursive
          window update path. I.e. cursor outside of visible range in
          large line that does not fit.
Solution: Make sure it is valid (Luuk van Baal).

closes: #15605

Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
  • Loading branch information
luukvbaal authored and chrisbra committed Sep 1, 2024
1 parent 9abd02d commit 3d5065f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/drawscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2774,14 +2774,15 @@ win_update(win_T *wp)
redrawWinline(wp, wp->w_cursor.lnum);
}
#endif
// New redraw either due to updated topline or due to wcol fix.
// New redraw either due to updated topline, wcol fix or reset skipcol.
if (wp->w_redr_type != 0)
{
// Don't update for changes in buffer again.
i = curbuf->b_mod_set;
curbuf->b_mod_set = FALSE;
j = curbuf->b_mod_xlines;
curbuf->b_mod_xlines = 0;
curs_columns(TRUE);
win_update(curwin);
curbuf->b_mod_set = i;
curbuf->b_mod_xlines = j;
Expand Down
16 changes: 8 additions & 8 deletions src/testdir/dumps/Test_smooth_long_scrolloff_1.dump
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
| +0&#ffffff0@39
@40
@40
> @39
@40
@40
@40
@40
|<+0#4040ff13#ffffff0@2|t+0#0000000&|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t
|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l
|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g|
>t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
| @39
14 changes: 7 additions & 7 deletions src/testdir/dumps/Test_smooth_long_scrolloff_7.dump
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
| +0&#ffffff0@39
@40
@40
@40
@40
@40
> @39
|<+0#4040ff13#ffffff0@2|l+0#0000000&|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l
|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g|
|t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
>g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| @20
@40
2 changes: 0 additions & 2 deletions src/testdir/test_scroll_opt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,6 @@ func Test_smooth_long_scrolloff()
END
call writefile(lines, 'XSmoothLongScrolloff', 'D')
let buf = RunVimInTerminal('-u NONE -S XSmoothLongScrolloff', #{rows: 8, cols: 40})
"FIXME: empty screen due to reset_skipcol()/curs_columns() shenanigans
call term_sendkeys(buf, ":norm j721|\<CR>")
call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_1', {})

Expand All @@ -1182,7 +1181,6 @@ func Test_smooth_long_scrolloff()
call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_6', {})

call term_sendkeys(buf, "gk")
"FIXME: empty screen due to reset_skipcol()/curs_columns() shenanigans
call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_7', {})

call StopVimInTerminal(buf)
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
708,
/**/
707,
/**/
Expand Down

0 comments on commit 3d5065f

Please sign in to comment.