mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.
b21b8e9ed0
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
c25fd85c2e
commit
6fd7e3bea4
@ -1465,7 +1465,10 @@ void adjust_skipcol(void)
|
|||||||
bool scrolled = false;
|
bool 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(curwin);
|
reset_skipcol(curwin);
|
||||||
return;
|
return;
|
||||||
|
@ -494,14 +494,7 @@ describe('smoothscroll', function()
|
|||||||
]])
|
]])
|
||||||
-- 'scrolloff' set to 2, scrolling down, cursor moves screen line up
|
-- 'scrolloff' set to 2, scrolling down, cursor moves screen line up
|
||||||
feed('<C-E>gj<C-Y>')
|
feed('<C-E>gj<C-Y>')
|
||||||
screen:expect([[
|
screen:expect_unchanged()
|
||||||
<<<ots of text with lots of text with lo|
|
|
||||||
ts of text with lots of text with lots o|
|
|
||||||
f text wi^th lots of text with lots of te|
|
|
||||||
xt with lots of text with lots of text w|
|
|
||||||
ith lots of text with lots of text with |
|
|
||||||
|
|
|
||||||
]])
|
|
||||||
-- 'scrolloff' set to 0, move cursor down one line. Cursor should move properly,
|
-- 'scrolloff' set to 0, move cursor down one line. Cursor should move properly,
|
||||||
-- and since this is a really long line, it will be put on top of the screen.
|
-- and since this is a really long line, it will be put on top of the screen.
|
||||||
exec('set scrolloff=0')
|
exec('set scrolloff=0')
|
||||||
|
@ -498,6 +498,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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user