diff options
| author | luukvbaal <luukvbaal@gmail.com> | 2025-02-12 11:01:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-12 11:01:06 +0100 |
| commit | 82a215cb2dc2b80c1b8bc455c90a928b636d8b3a (patch) | |
| tree | b264cb2900a0bd59b3ff4976f0cf47a06cfd5f19 /src/nvim/generators | |
| parent | 6982106f8ca5ceaa00c9909e64cc94d2794b9143 (diff) | |
| download | rneovim-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 'src/nvim/generators')
| -rw-r--r-- | src/nvim/generators/gen_events.lua | 49 | ||||
| -rw-r--r-- | src/nvim/generators/gen_vimvim.lua | 18 |
2 files changed, 24 insertions, 43 deletions
diff --git a/src/nvim/generators/gen_events.lua b/src/nvim/generators/gen_events.lua index ee48e918e8..8c87815a74 100644 --- a/src/nvim/generators/gen_events.lua +++ b/src/nvim/generators/gen_events.lua @@ -3,7 +3,6 @@ local names_file = arg[2] local auevents = require('auevents') local events = auevents.events -local aliases = auevents.aliases local enum_tgt = io.open(fileio_enum_file, 'w') local names_tgt = io.open(names_file, 'w') @@ -16,46 +15,28 @@ names_tgt:write([[ static const struct event_name { size_t len; char *name; - event_T event; + int event; } event_names[] = {]]) +local aliases = 0 for i, event in ipairs(events) do - enum_tgt:write(('\n EVENT_%s = %u,'):format(event:upper(), i - 1)) - names_tgt:write(('\n {%u, "%s", EVENT_%s},'):format(#event, event, event:upper())) + enum_tgt:write(('\n EVENT_%s = %u,'):format(event[1]:upper(), i + aliases - 1)) + -- Events with positive keys aren't allowed in 'eventignorewin'. + local event_int = ('%sEVENT_%s'):format(event[3] and '-' or '', event[1]:upper()) + names_tgt:write(('\n {%u, "%s", %s},'):format(#event[1], event[1], event_int)) + for _, alias in ipairs(event[2]) do + aliases = aliases + 1 + names_tgt:write(('\n {%u, "%s", %s},'):format(#alias, alias, event_int)) + enum_tgt:write(('\n EVENT_%s = %u,'):format(alias:upper(), i + aliases - 1)) + end if i == #events then -- Last item. - enum_tgt:write(('\n NUM_EVENTS = %u,'):format(i)) + enum_tgt:write(('\n NUM_EVENTS = %u,'):format(i + aliases)) end end -for _, v in ipairs(aliases) do - local alias = v[1] - local event = v[2] - names_tgt:write(('\n {%u, "%s", EVENT_%s},'):format(#alias, alias, event:upper())) -end - -names_tgt:write('\n {0, NULL, (event_T)0},') +names_tgt:write('\n {0, NULL, (event_T)0},\n};\n') +names_tgt:write('\nstatic AutoCmdVec autocmds[NUM_EVENTS] = { 0 };\n') +names_tgt:close() enum_tgt:write('\n} event_T;\n') -names_tgt:write('\n};\n') - -do - names_tgt:write('\nstatic AutoCmdVec autocmds[NUM_EVENTS] = {\n ') - local line_len = 1 - for _ = 1, (#events - 1) do - line_len = line_len + #' KV_INITIAL_VALUE,' - if line_len > 80 then - names_tgt:write('\n ') - line_len = 1 + #' KV_INITIAL_VALUE,' - end - names_tgt:write(' KV_INITIAL_VALUE,') - end - if line_len + #' KV_INITIAL_VALUE' > 80 then - names_tgt:write('\n KV_INITIAL_VALUE') - else - names_tgt:write(' KV_INITIAL_VALUE') - end - names_tgt:write('\n};\n') -end - enum_tgt:close() -names_tgt:close() diff --git a/src/nvim/generators/gen_vimvim.lua b/src/nvim/generators/gen_vimvim.lua index d8053822bf..3817735a55 100644 --- a/src/nvim/generators/gen_vimvim.lua +++ b/src/nvim/generators/gen_vimvim.lua @@ -114,19 +114,19 @@ local vimau_start = 'syn keyword vimAutoEvent contained ' w('\n\n' .. vimau_start) for _, au in ipairs(auevents.events) do - if not auevents.nvim_specific[au] then + if not auevents.nvim_specific[au[1]] then if lld.line_length > 850 then w('\n' .. vimau_start) end - w(' ' .. au) - end -end -for _, au in pairs(auevents.aliases) do - if lld.line_length > 850 then - w('\n' .. vimau_start) + w(' ' .. au[1]) + for _, alias in ipairs(au[2]) do + if lld.line_length > 850 then + w('\n' .. vimau_start) + end + -- au[1] is aliased to alias + w(' ' .. alias) + end end - -- au[1] is aliased to au[2] - w(' ' .. au[1]) end local nvimau_start = 'syn keyword nvimAutoEvent contained ' |