diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-07 18:34:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-07 18:34:39 +0800 |
commit | f92aab5f704f6e94e80f2fcbab42acc272a66a29 (patch) | |
tree | 8f107c2a9e5c6ddc21973e0f3bf8be96ab0791b9 /test | |
parent | f8aa2a0deaf473af0e6b4640356eaf5477c6ee90 (diff) | |
download | rneovim-f92aab5f704f6e94e80f2fcbab42acc272a66a29.tar.gz rneovim-f92aab5f704f6e94e80f2fcbab42acc272a66a29.tar.bz2 rneovim-f92aab5f704f6e94e80f2fcbab42acc272a66a29.zip |
vim-patch:9.0.1025: WinScrolled is not triggered when filler lines change (#21325)
Problem: WinScrolled is not triggered when filler lines change.
Solution: Add "topfill" to the values that WinScrolled triggers on.
(closes vim/vim#11668)
https://github.com/vim/vim/commit/3fc84dc2c7efecd7c14ce341cd777475058936fd
Cherry-pick StopVimInTerminal() from patch 9.0.1010.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/autocmd/win_scrolled_resized_spec.lua | 100 |
1 files changed, 70 insertions, 30 deletions
diff --git a/test/functional/autocmd/win_scrolled_resized_spec.lua b/test/functional/autocmd/win_scrolled_resized_spec.lua index bebb21bc31..4a2e27931a 100644 --- a/test/functional/autocmd/win_scrolled_resized_spec.lua +++ b/test/functional/autocmd/win_scrolled_resized_spec.lua @@ -70,15 +70,15 @@ describe('WinScrolled', function() feed('<C-E>') eq(1, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) feed('<C-Y>') eq(2, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) end) @@ -93,15 +93,15 @@ describe('WinScrolled', function() feed('zl') eq(1, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) feed('zh') eq(2, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) end) @@ -115,29 +115,29 @@ describe('WinScrolled', function() feed('zl') eq(1, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) feed('zl') eq(2, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) feed('h') eq(3, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) feed('zh') eq(4, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) end) @@ -152,15 +152,15 @@ describe('WinScrolled', function() feed('gj') eq(1, eval('g:scrolled')) eq({ - all = {leftcol = 0, topline = 0, width = 0, height = 0, skipcol = width}, - ['1000'] = {leftcol = 0, topline = 0, width = 0, height = 0, skipcol = width}, + all = {leftcol = 0, topline = 0, topfill = 0, width = 0, height = 0, skipcol = width}, + ['1000'] = {leftcol = 0, topline = 0, topfill = 0, width = 0, height = 0, skipcol = width}, }, eval('g:v_event')) feed('0') eq(2, eval('g:scrolled')) eq({ - all = {leftcol = 0, topline = 0, width = 0, height = 0, skipcol = width}, - ['1000'] = {leftcol = 0, topline = 0, width = 0, height = 0, skipcol = -width}, + all = {leftcol = 0, topline = 0, topfill = 0, width = 0, height = 0, skipcol = width}, + ['1000'] = {leftcol = 0, topline = 0, topfill = 0, width = 0, height = 0, skipcol = -width}, }, eval('g:v_event')) feed('$') @@ -181,15 +181,15 @@ describe('WinScrolled', function() feed('i<C-X><C-E><Esc>') eq(1, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) feed('i<C-X><C-Y><Esc>') eq(2, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) feed('L') @@ -198,8 +198,8 @@ describe('WinScrolled', function() feed('A<CR><Esc>') eq(3, eval('g:scrolled')) eq({ - 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}, }, eval('g:v_event')) end) end) @@ -244,6 +244,46 @@ describe('WinScrolled', function() assert_alive() end) + -- oldtest: Test_WinScrolled_diff() + it('is triggered for both windows when scrolling in diff mode', function() + exec([[ + 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 + au WinScrolled * let g:v_event = deepcopy(v:event) + ]]) + + feed('<C-E>') + eq({ + 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}, + }, eval('g:v_event')) + + feed('2<C-E>') + eq({ + 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}, + }, eval('g:v_event')) + + feed('<C-E>') + eq({ + 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}, + }, eval('g:v_event')) + + feed('2<C-Y>') + eq({ + 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}, + }, eval('g:v_event')) + end) + it('is triggered by mouse scrolling in unfocused floating window #18222', function() local screen = Screen.new(80, 24) screen:attach() @@ -270,16 +310,16 @@ describe('WinScrolled', function() eq(1, eval('g:scrolled')) eq(winid_str, eval('g:amatch')) eq({ - all = {leftcol = 0, topline = 3, width = 0, height = 0, skipcol = 0}, - [winid_str] = {leftcol = 0, topline = 3, width = 0, height = 0, skipcol = 0}, + all = {leftcol = 0, topline = 3, topfill = 0, width = 0, height = 0, skipcol = 0}, + [winid_str] = {leftcol = 0, topline = 3, topfill = 0, width = 0, height = 0, skipcol = 0}, }, eval('g:v_event')) meths.input_mouse('wheel', 'up', '', 0, 3, 3) eq(2, eval('g:scrolled')) eq(tostring(win.id), eval('g:amatch')) eq({ - all = {leftcol = 0, topline = 3, width = 0, height = 0, skipcol = 0}, - [winid_str] = {leftcol = 0, topline = -3, width = 0, height = 0, skipcol = 0}, + all = {leftcol = 0, topline = 3, topfill = 0, width = 0, height = 0, skipcol = 0}, + [winid_str] = {leftcol = 0, topline = -3, topfill = 0, width = 0, height = 0, skipcol = 0}, }, eval('g:v_event')) end) end) |