1
0
forked from aniani/vim

patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily

Problem:    With 'smoothscroll' skipcol may be reset unnecessarily.
Solution:   Check the line does actually fit in the window.
This commit is contained in:
Bram Moolenaar
2022-12-03 18:35:07 +00:00
parent c0370529c0
commit b21b8e9ed0
4 changed files with 19 additions and 6 deletions

View File

@@ -1909,7 +1909,11 @@ adjust_skipcol(void)
int scrolled = FALSE; int scrolled = FALSE;
validate_cheight(); validate_cheight();
if (curwin->w_cline_height == curwin->w_height) if (curwin->w_cline_height == curwin->w_height
// w_cline_height may be capped at w_height, check there aren't
// actually more lines.
&& plines_win(curwin, curwin->w_cursor.lnum, FALSE)
<= curwin->w_height)
{ {
// the line just fits in the window, don't scroll // the line just fits in the window, don't scroll
reset_skipcol(); reset_skipcol();

View File

@@ -1,6 +1,6 @@
|<+0#4040ff13#ffffff0@2|o+0#0000000&|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o |<+0#4040ff13#ffffff0@2|t+0#0000000&|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t
|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o |h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o
|f| |t|e|x|t| |w|i>t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e |t|s| |o|f| |t|e|x>t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o
|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e
|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w |x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w
|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |:|s|e|t| |s|c|r|o|l@1|o| @9|3|,|1|3|0| @8|6@1|%|
@22|3|,|1|7|0| @8|6@1|%|

View File

@@ -481,6 +481,13 @@ func Test_smoothscroll_cursor_scrolloff()
exe "normal 20h" exe "normal 20h"
call s:check_col_calc(1, 4, 61) call s:check_col_calc(1, 4, 61)
" cursor on last line, "gk" should not cause a scroll
set scrolloff=0
normal G0
call s:check_col_calc(1, 7, 1)
normal gk
call s:check_col_calc(1, 6, 101)
bwipe! bwipe!
endfunc endfunc

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1000,
/**/ /**/
999, 999,
/**/ /**/