aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2025-02-12 11:01:06 +0100
committerGitHub <noreply@github.com>2025-02-12 11:01:06 +0100
commit82a215cb2dc2b80c1b8bc455c90a928b636d8b3a (patch)
treeb264cb2900a0bd59b3ff4976f0cf47a06cfd5f19 /test/functional/legacy
parent6982106f8ca5ceaa00c9909e64cc94d2794b9143 (diff)
downloadrneovim-82a215cb2dc2b80c1b8bc455c90a928b636d8b3a.tar.gz
rneovim-82a215cb2dc2b80c1b8bc455c90a928b636d8b3a.tar.bz2
rneovim-82a215cb2dc2b80c1b8bc455c90a928b636d8b3a.zip
feat(options): add 'eventignorewin' (#32152)
vim-patch:partial:9.1.1084: Unable to persistently ignore events in a window and its buffers Problem: Unable to persistently ignore events in a window and its buffers. Solution: Add 'eventignorewin' option to ignore events in a window and buffer (Luuk van Baal) Add the window-local 'eventignorewin' option that is analogous to 'eventignore', but applies to a certain window and its buffers. Identify events that should be allowed in 'eventignorewin', adapt "auto_event" and "event_tab" to encode this information. Window context is not passed onto apply_autocmds_group(), and when to ignore an event is a bit ambiguous when "buf" is not "curbuf", rather than a large refactor, only ignore an event when all windows into "buf" are ignoring the event. https://github.com/vim/vim/commit/b7147f8236c962cd74d1ce028d9106f1c449ea6c vim-patch:9.1.1102: tests: Test_WinScrolled_Resized_eiw() uses wrong filename Problem: tests: Test_WinScrolled_Resized_eiw() uses wrong filename (Luuk van Baal, after v9.1.1084) Solution: Rename the filename to something more unique https://github.com/vim/vim/commit/bfc7719e48ffc365ee0a1bd1888120d26b6365f0
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/autocmd_spec.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/functional/legacy/autocmd_spec.lua b/test/functional/legacy/autocmd_spec.lua
index 4d82da6312..1071776b68 100644
--- a/test/functional/legacy/autocmd_spec.lua
+++ b/test/functional/legacy/autocmd_spec.lua
@@ -1,5 +1,6 @@
local t = require('test.testutil')
local n = require('test.functional.testnvim')()
+local Screen = require('test.functional.ui.screen')
local clear = n.clear
local write_file = t.write_file
@@ -40,3 +41,53 @@ it('no E440 in quickfix window when autocommand invalidates undo', function()
feed('G')
eq('', api.nvim_get_vvar('errmsg'))
end)
+
+-- oldtest: Test_WinScrolled_Resized_eiw()
+it('WinScrolled and WinResized events can be ignored in a window', function()
+ local screen = Screen.new()
+ n.exec([[
+ call setline(1, ['foo']->repeat(32))
+ set eventignorewin=WinScrolled,WinResized
+ split
+ let [g:afile,g:resized,g:scrolled] = ['none',0,0]
+ au WinScrolled * let [g:afile,g:scrolled] = [expand('<afile>'),g:scrolled+1]
+ au WinResized * let [g:afile,g:resized] = [expand('<afile>'),g:resized+1]
+ ]])
+ feed('<C-W>-')
+ screen:expect([[
+ ^foo |
+ foo |*4
+ {3:[No Name] [+] }|
+ foo |*6
+ {2:[No Name] [+] }|
+ |
+ ]])
+ feed(':echo g:afile g:resized g:scrolled<CR>')
+ screen:expect({ any = 'none 0 0.*' })
+ feed('G')
+ screen:expect([[
+ foo |*4
+ ^foo |
+ {3:[No Name] [+] }|
+ foo |*6
+ {2:[No Name] [+] }|
+ none 0 0 |
+ ]])
+ feed('gg')
+ screen:expect([[
+ ^foo |
+ foo |*4
+ {3:[No Name] [+] }|
+ foo |*6
+ {2:[No Name] [+] }|
+ none 0 0 |
+ ]])
+ feed(':echo g:afile g:resized g:scrolled')
+ screen:expect({ any = ':echo g:afile g:resized g:scrolled.*' })
+ feed('<CR>')
+ screen:expect({ any = 'none 0 0.*' })
+ feed(':set eventignorewin=<CR><C-W>w<C-W>+')
+ screen:expect({ any = ':set eventignorewin=.*' })
+ feed(':echo win_getid() g:afile g:resized g:scrolled<CR>')
+ screen:expect({ any = '1000 1001 1 1.*' })
+end)