vim-patch:8.2.2495: text jumps up and down when moving the cursor

Problem:    Text jumps up and down when moving the cursor in a small window
            with wrapping text and 'scrolloff' set.
Solution:   Adjust the computation of w_skipcol. (partly by Ghjuvan Lacambre,
            closes vim/vim#7813)
8f33ebfade
This commit is contained in:
Jan Edmund Lazo
2021-02-10 18:05:21 -05:00
parent 89143b5fc4
commit c3dada3e5a
2 changed files with 3 additions and 3 deletions

View File

@@ -888,11 +888,11 @@ void curs_columns(
} else { } else {
n = plines; n = plines;
} }
if ((colnr_T)n >= wp->w_height_inner + wp->w_skipcol / width) { if ((colnr_T)n >= wp->w_height_inner + wp->w_skipcol / width - so) {
extra += 2; extra += 2;
} }
if (extra == 3 || plines < so * 2) { if (extra == 3 || plines <= so * 2) {
// not enough room for 'scrolloff', put cursor in the middle // not enough room for 'scrolloff', put cursor in the middle
n = wp->w_virtcol / width; n = wp->w_virtcol / width;
if (n > wp->w_height_inner / 2) { if (n > wp->w_height_inner / 2) {

View File

@@ -352,7 +352,7 @@ func Test_breakindent19_sbr_nextpage()
call s:compare_lines(expect, lines) call s:compare_lines(expect, lines)
" Scroll down one screen line " Scroll down one screen line
setl scrolloff=5 setl scrolloff=5
norm! 5gj norm! 6gj
redraw! redraw!
let lines = s:screen_lines(1, 20) let lines = s:screen_lines(1, 20)
let expect = [ let expect = [