diff --git a/src/move.c b/src/move.c index 1c1eddeef5..e3771a5e26 100644 --- a/src/move.c +++ b/src/move.c @@ -3215,10 +3215,10 @@ static int scroll_with_sms(int dir, long count, long *curscount) int width1 = curwin->w_width - curwin_col_off(); int width2 = width1 + curwin_col_off2(); - count = 1 + (curwin->w_skipcol - width1) / width2; + count = 1 + (curwin->w_skipcol - width1 - 1) / width2; if (fixdir == FORWARD) - count = 2 + (linetabsize_eol(curwin, curwin->w_topline) - - curwin->w_skipcol - width1) / width2; + count = 1 + (linetabsize_eol(curwin, curwin->w_topline) + - curwin->w_skipcol - width1 + width2 - 1) / width2; scroll_redraw(fixdir == FORWARD, count); *curscount += count * (fixdir == dir ? 1 : -1); } diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim index 7f4f909645..069651f6bc 100644 --- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -4354,4 +4354,21 @@ func Test_scroll_longline_benchmark() bwipe! endfunc +" Test Ctrl-B with 'nosmoothscroll' not stuck with line exactly window width. +func Test_scroll_longline_winwidth() + 10new + call setline(1, ['']->repeat(20) + ['A'->repeat(20 * winwidth(0))] + ['']->repeat(20)) + exe "normal! G3\" + call assert_equal(22, line('w0')) + exe "normal! \" + call assert_equal(21, line('w0')) + exe "normal! \" + call assert_equal(11, line('w0')) + exe "normal! \" + call assert_equal(3, line('w0')) + exe "normal! \" + call assert_equal(1, line('w0')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable diff --git a/src/version.c b/src/version.c index 7e6e862de6..89c9fb0f3f 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1388, /**/ 1387, /**/