Mercurial > vim
comparison src/move.c @ 23905:68f506771741 v8.2.2495
patch 8.2.2495: text jumps up and down when moving the cursor
Commit: https://github.com/vim/vim/commit/8f33ebfade10cd1b4296d8ec8dca815a09e8a405
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 10 21:10:12 2021 +0100
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 #7813)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 10 Feb 2021 21:15:04 +0100 |
parents | 90ea5037a7e3 |
children | 406ab8d0bc0f |
comparison
equal
deleted
inserted
replaced
23904:e2c0053823a5 | 23905:68f506771741 |
---|---|
1123 --p_lines; | 1123 --p_lines; |
1124 if (p_lines > curwin->w_wrow + so) | 1124 if (p_lines > curwin->w_wrow + so) |
1125 n = curwin->w_wrow + so; | 1125 n = curwin->w_wrow + so; |
1126 else | 1126 else |
1127 n = p_lines; | 1127 n = p_lines; |
1128 if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width) | 1128 if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width - so) |
1129 extra += 2; | 1129 extra += 2; |
1130 | 1130 |
1131 if (extra == 3 || p_lines < so * 2) | 1131 if (extra == 3 || p_lines <= so * 2) |
1132 { | 1132 { |
1133 // not enough room for 'scrolloff', put cursor in the middle | 1133 // not enough room for 'scrolloff', put cursor in the middle |
1134 n = curwin->w_virtcol / width; | 1134 n = curwin->w_virtcol / width; |
1135 if (n > curwin->w_height / 2) | 1135 if (n > curwin->w_height / 2) |
1136 n -= curwin->w_height / 2; | 1136 n -= curwin->w_height / 2; |