summaryrefslogtreecommitdiffstats
path: root/src/autocmd.c
AgeCommit message (Collapse)Author
2024-04-16patch 9.1.0341: Problem: a few memory leaks are foundv9.1.0341Christian Brabandt
Problem: a few memory leaks are found (LuMingYinDetect ) Solution: properly free the memory Fixes the following problems: - Memory leak in f_maplist() fixes: #14486 - Memory leak in option.c fixes: #14485 - Memory leak in f_resolve() fixes: #14484 - Memory leak in f_autocmd_get() related: #14474 - Memory leak in dict_extend_func() fixes: #14477 fixes: #14238 closes: #14517 Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-07patch 9.1.0272: autocmd may change cwd after :tcd and :lcdv9.1.0272zeertzjq
Problem: Autocommand may change currect directory after :tcd and :lcd. Solution: Also clear tp_localdir and w_localdir when using aucmd_win. (zeertzjq) closes: #14435 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-02patch 9.1.0256: Finding autocmd events is inefficientv9.1.0256John Marriott
Problem: Finding autocmd events is inefficient Solution: Use binary search to find events, cache last found events, avoid use of strlen(), add SessionWritePost autocmd, fix test_codestyle and avoid endless loop (John Marriott) closes: #14287 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-31patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other bufv9.1.0231zeertzjq
Problem: Filetype may be undetected when a SwapExists autocommand sets filetype in another buffer. Solution: Make filetype detection state buffer-specific. Also fix a similar problem for 'modified' (zeertzjq). closes: #14344 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-26patch 9.1.0207: No autocommand when writing session filev9.1.0207Colin Kennedy
Problem: No autocommand when writing session file Solution: Add SessionWritePost autocommand (Colin Kennedy) fixes: ##14242 closes: #14288 Co-authored-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Colin Kennedy <colinvfx@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-20patch 9.1.0118: Use different restoration strategy in win_splitmovev9.1.0118Sean Dewar
Problem: saving and restoring all frames to split-move is overkill now that WinNewPre is not fired when split-moving. Solution: defer the flattening of frames until win_split_ins begins reorganising them, and attempt to restore the layout by undoing our changes. (Sean Dewar) This also means we no longer must allocate. related: #14042 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-20patch 9.1.0116: win_split_ins may not check available roomv9.1.0116Sean Dewar
Problem: win_split_ins has no check for E36 when moving an existing window Solution: check for room and fix the issues in f_win_splitmove() (Sean Dewar) win_split_ins has no check for E36 when moving an existing window, allowing for layouts with many overlapping zero-sized windows to be created (which may also cause drawing issues with tablines and such). f_win_splitmove also has some bugs. So check for room and fix the issues in f_win_splitmove. Handle failure in the two relevant win_split_ins callers by restoring the original layout, and factor the common logic into win_splitmove. Don't check for room when opening an autocommand window, as it's a temporary window that's rarely interacted with or drawn anyhow, and is rather important for some autocommands. Issues fixed in f_win_splitmove: - Error if splitting is disallowed. - Fix heap-use-after-frees if autocommands fired from switching to "targetwin" close "wp" or "oldwin". - Fix splitting the wrong window if autocommands fired from switching to "targetwin" switch to a different window. - Ensure -1 is returned for all errors. Also handle allocation failure a bit earlier in make_snapshot (callers, except win_splitmove, don't really care if a snapshot can't be made, so just ignore the return value). Note: Test_smoothscroll_in_zero_width_window failed after these changes with E36, as it was using the previous behaviour to create a zero-width window. I've fixed the test such that it fails with UBSAN as expected when v9.0.1367 is reverted (and simplified it too). related: #14042 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-25patch 9.1.0059: No event triggered before creating a windowv9.1.0059Sergey Vlasov
Problem: No event is triggered before creating a window. (Sergey Vlasov) Solution: Add the WinNewPre event (Sergey Vlasov) fixes: #10635 closes: #12761 Signed-off-by: Sergey Vlasov <sergey@vlasov.me> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-17patch 9.1.0040: issue with prompt buffer and hidden bufferv9.1.0040zeertzjq
Problem: Modifying a hidden buffer still interferes with prompt buffer mode changes. Solution: Save and restore b_prompt_insert. (zeertzjq) closes: #13875 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org> Modifying hidden buffer still interferes with prompt buffer mode changes
2024-01-14patch 9.1.0029: Cannot act on various terminal response codesv9.1.0029Danek Duvall
Problem: Cannot act on various terminal response codes Solution: Add the TerminalResponseAll autocommand (Danek Duvall) closes: #13829 Signed-off-by: Danek Duvall <duvall@comfychair.org> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-09-29patch 9.0.1958: cannot complete option valuesv9.0.1958Yee Cheng Chin
Problem: cannot complete option values Solution: Add completion functions for several options Add cmdline tab-completion for setting string options Add tab-completion for setting string options on the cmdline using `:set=` (along with `:set+=` and `:set-=`). The existing tab completion for setting options currently only works when nothing is typed yet, and it only fills in with the existing value, e.g. when the user does `:set diffopt=<Tab>` it will be completed to `set diffopt=internal,filler,closeoff` and nothing else. This isn't too useful as a user usually wants auto-complete to suggest all the possible values, such as 'iblank', or 'algorithm:patience'. For set= and set+=, this adds a new optional callback function for each option that can be invoked when doing completion. This allows for each option to have control over how completion works. For example, in 'diffopt', it will suggest the default enumeration, but if `algorithm:` is selected, it will further suggest different algorithm types like 'meyers' and 'patience'. When using set=, the existing option value will be filled in as the first choice to preserve the existing behavior. When using set+= this won't happen as it doesn't make sense. For flag list options (e.g. 'mouse' and 'guioptions'), completion will take into account existing typed values (and in the case of set+=, the existing option value) to make sure it doesn't suggest duplicates. For set-=, there is a new `ExpandSettingSubtract` function which will handle flag list and comma-separated options smartly, by only suggesting values that currently exist in the option. Note that Vim has some existing code that adds special handling for 'filetype', 'syntax', and misc dir options like 'backupdir'. This change preserves them as they already work, instead of converting to the new callback API for each option. closes: #13182 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-09-24patch 9.0.1934: :bwipe fails after switching window from aucmd_win.v9.0.1934zeertzjq
Problem: :bwipe fails after switching window from aucmd_win. Solution: Decrement b_nwindows after switching back to aucmd_win. closes: #13160 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-06-25patch 9.0.1665: empty CmdlineEnter autocommand causes errors in Ex modev9.0.1665Christian Brabandt
Problem: Empty CmdlineEnter autocommand causes errors in Ex mode. Solution: Save and restore ex_pressedreturn. (Christian Brabandt, closes # 12581, closes #12578)
2023-05-27patch 9.0.1582: :stopinsert may not work in a popup close handlerv9.0.1582zeertzjq
Problem: :stopinsert may not work in a popup close handler. (Ben Jackson) Solution: Restore stop_insert_mode when appropriate. (closes #12452, closes #12434)
2023-05-20patch 9.0.1571: RedrawingDisabled not used consistentlyv9.0.1571Bram Moolenaar
Problem: RedrawingDisabled not used consistently. Solution: Avoid RedrawingDisabled going negative. Set RedrawingDisabled in win_split_ins(). (closes #11961)
2023-04-15patch 9.0.1454: code indenting is confused by macrosv9.0.1454ichizok
Problem: Code indenting is confused by macros. Solution: Put semicolon after the macros instead of inside. (Ozaki Kiichi, closes #12257)
2023-04-09patch 9.0.1443: ending Insert mode when accessing a hidden prompt bufferv9.0.1443Bram Moolenaar
Problem: Ending Insert mode when accessing a hidden prompt buffer. Solution: Don't stop Insert mode when it was active before. (closes #12237)
2023-04-02patch 9.0.1439: start Insert mode when accessing a hidden prompt bufferv9.0.1439orbital
Problem: Start Insert mode when accessing a hidden prompt buffer. Solution: Call leaving_window() in aucmd_restbuf(). (Thorben Tröbst, closes #12148, closes #12147)
2023-03-12patch 9.0.1403: unused variables and functionsv9.0.1403Dominique Pelle
Problem: Unused variables and functions. Solution: Delete items and adjust #ifdefs. (Dominique Pellé, closes #12145)
2023-02-04patch 9.0.1277: cursor may move with autocmd in Visual modev9.0.1277zeertzjq
Problem: Cursor may move with autocmd in Visual mode. Solution: Restore "VIsual_active" before calling check_cursor(). (closes #11939)
2023-01-09patch 9.0.1166: code is indented more than necessaryv9.0.1166Yegappan Lakshmanan
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11792)
2022-12-09patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twicev9.0.1039Bram Moolenaar
Problem: Using a <Cmd> mapping CmdlineChanged may be triggered twice. Solution: Count the number of times CmdlineChanged is triggered and avoid doing it twice. (closes #116820
2022-11-28patch 9.0.0967: leaking memory from autocmd windowsv9.0.0967Bram Moolenaar
Problem: Leaking memory from autocmd windows. Solution: Free window when auc_win is not NULL.
2022-11-28patch 9.0.0965: using one window for executing autocommands is insufficientv9.0.0965Bram Moolenaar
Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands.
2022-11-22patch 9.0.0917: the WinScrolled autocommand event is not enoughv9.0.0917Bram Moolenaar
Problem: The WinScrolled autocommand event is not enough. Solution: Add WinResized and provide information about what changed. (closes #11576)
2022-11-20patch 9.0.0915: WinScrolled may trigger immediately when definedv9.0.0915Bram Moolenaar
Problem: WinScrolled may trigger immediately when defined. Solution: Initialize the fields in all windows. (closes #11582)
2022-11-13patch 9.0.0871: using freed memory when clearing augroup at more promptv9.0.0871Bram Moolenaar
Problem: Using freed memory when clearing augroup at more prompt. Solution: Delay clearing augroup until it's safe. (closes #11441)
2022-10-15patch 9.0.0756: no autocmd event for changing text in a terminal windowv9.0.0756Shougo Matsushita
Problem: No autocmd event for changing text in a terminal window. Solution: Add TextChangedT. (Shougo Matsushita, closes #11366)
2022-10-10patch 9.0.0713: <amatch> of MenuPopup event is expanded like a file namev9.0.0713zeertzjq
Problem: <amatch> of MenuPopup event is expanded like a file name. Solution: Do not expand <amatch> for MenuPopup. (closes #11328)
2022-09-24patch 9.0.0568: autocmd code is indented more than neededv9.0.0568Yegappan Lakshmanan
Problem: Autocmd code is indented more than needed. Solution: Break out sooner. (Yegappan Lakshmanan, closes #11208) Also in user function code.
2022-08-28patch 9.0.0304: WinScrolled is not triggered when only skipcol changesv9.0.0304zeertzjq
Problem: WinScrolled is not triggered when only skipcol changes. Solution: Add w_last_skipcol and use it. (closes #10998)
2022-07-23patch 9.0.0063: too many type casts for dict_get functionsv9.0.0063Bram Moolenaar
Problem: Too many type casts for dict_get functions. Solution: Change the key argument from "char_u *" to "char *".
2022-07-23patch 9.0.0061: ml_get error with nested autocommandv9.0.0061Bram Moolenaar
Problem: ml_get error with nested autocommand. Solution: Also check line numbers for a nested autocommand. (closes #10761)
2022-06-14patch 8.2.5089: some functions return a different value on failurev8.2.5089Yegappan Lakshmanan
Problem: Some functions return a different value on failure. Solution: Initialize the return value earlier. (Yegappan Lakshmanan, closes #10568)
2022-06-01patch 8.2.5051: check for autocmd_add() event argument is confusingv8.2.5051Bram Moolenaar
Problem: Check for autocmd_add() event argument is confusing. Solution: Make the code more straightforward.
2022-06-01patch 8.2.5049: insufficient tests for autocommandsv8.2.5049Yegappan Lakshmanan
Problem: Insufficient tests for autocommands. Solution: Add a few more tests. (Yegappan Lakshmanan, closes #10507)
2022-05-27patch 8.2.5033: build error with +eval but without +quickfixv8.2.5033Bram Moolenaar
Problem: Build error with +eval but without +quickfix. Warning for uninitialized variable. Solution: Adjust #ifdefs. (John Marriott)
2022-05-27patch 8.2.5030: autocmd_add() can only handle one event and patternv8.2.5030Yegappan Lakshmanan
Problem: autocmd_add() can only handle one event and pattern. Solution: Support a list of events and patterns. (Yegappan Lakshmanan, closes #10483)
2022-05-24patch 8.2.5011: Replacing an autocommand requires several linesv8.2.5011Yegappan Lakshmanan
Problem: Replacing an autocommand requires several lines. Solution: Add the "replace" flag to autocmd_add(). (Yegappan Lakshmanan, closes #10473)
2022-05-19patch 8.2.4981: it is not possible to manipulate autocommandsv8.2.4981Yegappan Lakshmanan
Problem: It is not possible to manipulate autocommands. Solution: Add functions to add, get and set autocommands. (Yegappan Lakshmanan, closes #10291)
2022-05-07patch 8.2.4911: the mode #defines are not clearly namedv8.2.4911Bram Moolenaar
Problem: The mode #defines are not clearly named. Solution: Prepend MODE_. Renumber them to put the mapped modes first.
2022-04-14patch 8.2.4749: <script> is not expanded in autocmd contextv8.2.4749LemonBoy
Problem: <script> is not expanded in autocmd context. Solution: Add the context to the pattern struct. (closes #10144) Rename AutoPatCmd to AutoPatCmd_T.
2022-04-09patch 8.2.4723: the ModeChanged autocmd event is inefficientv8.2.4723LemonBoy
Problem: The ModeChanged autocmd event is inefficient. Solution: Avoid allocating memory. (closes #10134) Rename trigger_modechanged() to may_trigger_modechanged().
2022-04-08patch 8.2.4713: plugins cannot track text scrollingv8.2.4713LemonBoy
Problem: Plugins cannot track text scrolling. Solution: Add the WinScrolled event. (closes #10102)
2022-03-04patch 8.2.4505: Vim9: outdated "autocmd nested" still worksv8.2.4505Bram Moolenaar
Problem: Vim9: outdated "autocmd nested" still works. Solution: Do not accept the :autocmd argument "nested" without "++" in Vim9 script.
2022-02-16patch 8.2.4402: missing parenthesis may cause unexpected problemsv8.2.4402kylo252
Problem: Missing parenthesis may cause unexpected problems. Solution: Add more parenthesis is macros. (closes #9788)
2022-02-11patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPrev8.2.4345Bram Moolenaar
Problem: <amatch> is expanded like a file name for DirChangedPre. Solution: Do not expand <amatch>. (closes #9742) Also for the User event.
2022-02-09patch 8.2.4335: no autocommand event triggered before changing directoryv8.2.4335Bram Moolenaar
Problem: No autocommand event triggered before changing directory. (Ronnie Magatti) Solution: Add DirChangedPre. (closes #9721)
2022-01-24patch 8.2.4208: using setbufvar() may change the window titlev8.2.4208Bram Moolenaar
Problem: Using setbufvar() may change the window title. Solution: Do not redraw when creating the autocommand window. (closes #9613)
2022-01-07patch 8.2.4028: ml_get error with :doautoall and Visual areav8.2.4028Bram Moolenaar
Problem: ml_get error with :doautoall and Visual area. (Sean Dewar) Solution: Disable Visual mode while executing autocommands.