forked from aniani/vim
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Problem: WinScrolled is not triggered when filler lines change.
Solution: Add "topfill" to the values that WinScrolled triggers on.
(closes #11668)
This commit is contained in:
@@ -393,8 +393,8 @@ func Test_WinScrolled()
|
||||
|
||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||
call assert_equal({
|
||||
\ 'all': {'leftcol': 1, 'topline': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': -1, 'topline': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ 'all': {'leftcol': 1, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': -1, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ }, event)
|
||||
|
||||
" Scroll up/down in Normal mode.
|
||||
@@ -403,8 +403,8 @@ func Test_WinScrolled()
|
||||
|
||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||
call assert_equal({
|
||||
\ 'all': {'leftcol': 0, 'topline': 1, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': 0, 'topline': -1, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': 0, 'topline': -1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ }, event)
|
||||
|
||||
" Scroll up/down in Insert mode.
|
||||
@@ -414,8 +414,8 @@ func Test_WinScrolled()
|
||||
|
||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||
call assert_equal({
|
||||
\ 'all': {'leftcol': 0, 'topline': 1, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': 0, 'topline': -1, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': 0, 'topline': -1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ }, event)
|
||||
|
||||
" Scroll the window horizontally to focus the last letter of the third line
|
||||
@@ -427,8 +427,8 @@ func Test_WinScrolled()
|
||||
|
||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||
call assert_equal({
|
||||
\ 'all': {'leftcol': 5, 'topline': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': -5, 'topline': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ 'all': {'leftcol': 5, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': -5, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ }, event)
|
||||
|
||||
" Ensure the command was triggered for the specified window ID.
|
||||
@@ -582,6 +582,66 @@ func Test_WinScrolled_long_wrapped()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_WinScrolled_diff()
|
||||
CheckRunVimInTerminal
|
||||
|
||||
let lines =<< trim END
|
||||
set diffopt+=foldcolumn:0
|
||||
call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
|
||||
vnew
|
||||
call setline(1, ['d', 'e', 'f', 'g', 'h', 'i'])
|
||||
windo diffthis
|
||||
func WriteScrollEvent()
|
||||
call writefile([json_encode(v:event)], 'XscrollEvent')
|
||||
endfunc
|
||||
au WinScrolled * call WriteScrollEvent()
|
||||
END
|
||||
call writefile(lines, 'Xtest_winscrolled_diff', 'D')
|
||||
let buf = RunVimInTerminal('-S Xtest_winscrolled_diff', {'rows': 8})
|
||||
|
||||
call term_sendkeys(buf, "\<C-E>")
|
||||
call WaitForAssert({-> assert_match('^d', term_getline(buf, 3))}, 1000)
|
||||
|
||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||
call assert_equal({
|
||||
\ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1001': {'leftcol': 0, 'topline': 0, 'topfill': -1, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ }, event)
|
||||
|
||||
call term_sendkeys(buf, "2\<C-E>")
|
||||
call WaitForAssert({-> assert_match('^f', term_getline(buf, 3))}, 1000)
|
||||
|
||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||
call assert_equal({
|
||||
\ 'all': {'leftcol': 0, 'topline': 2, 'topfill': 2, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': 0, 'topline': 2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1001': {'leftcol': 0, 'topline': 0, 'topfill': -2, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ }, event)
|
||||
|
||||
call term_sendkeys(buf, "\<C-E>")
|
||||
call WaitForAssert({-> assert_match('^g', term_getline(buf, 3))}, 1000)
|
||||
|
||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||
call assert_equal({
|
||||
\ 'all': {'leftcol': 0, 'topline': 2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1001': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ }, event)
|
||||
|
||||
call term_sendkeys(buf, "2\<C-Y>")
|
||||
call WaitForAssert({-> assert_match('^e', term_getline(buf, 3))}, 1000)
|
||||
|
||||
let event = readfile('XscrollEvent')[0]->json_decode()
|
||||
call assert_equal({
|
||||
\ 'all': {'leftcol': 0, 'topline': 3, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1000': {'leftcol': 0, 'topline': -2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0},
|
||||
\ '1001': {'leftcol': 0, 'topline': -1, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0}
|
||||
\ }, event)
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_WinClosed()
|
||||
" Test that the pattern is matched against the closed window's ID, and both
|
||||
" <amatch> and <afile> are set to it.
|
||||
|
||||
Reference in New Issue
Block a user