summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_autocmd.vim
AgeCommit message (Collapse)Author
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-05patch 9.1.0269: Test for TextChanged is still flaky with ASANv9.1.0269zeertzjq
Problem: Test for TextChanged is still flaky with ASAN. Solution: Don't index the result of readfile(). (zeertzjq) It turns out that with ASAN the file may become empty during a write even if it's non-empty both before and after the write, in which case indexing the result of readfile() will error, so use join() instead. Also don't delete the file halfway the test, just in case it may cause errors on the next read. closes: #14421 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-04patch 9.1.0262: Test for TextChanged is flaky with ASANv9.1.0262zeertzjq
Problem: Test for TextChanged is flaky with ASAN. Solution: Wait for the file to be non-empty. (zeertzjq) closes: #14404 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-03patch 9.1.0259: Normal mode TextChanged isn't tested properlyv9.1.0259zeertzjq
Problem: Normal mode TextChanged isn't tested properly. Solution: Combine Test_Changed_ChangedI() and Test_Changed_ChangedI_2() and also run it on Windows. Fix a typo in main.c. (zeertzjq) closes: #14396 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-01patch 9.1.0251: Filetype test failsv9.1.0251zeertzjq
Problem: Filetype test fails. Solution: Move detection by name before detection by extension. Improve TextChanged test and remove wrong test and fix a typo in a comment (zeertzjq). closes: #14373 Signed-off-by: zeertzjq <zeertzjq@outlook.com> 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-31patch 9.1.0230: TextChanged autocommand not triggered under some circumstancesv9.1.0230Christian Brabandt
Problem: TextChanged autocommand not triggered under some circumstances (Sergey Vlasov) Solution: Trigger TextChanged when TextChangedI has not been triggered fixes: #14332 closes: #14339 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-03-09patch 9.1.0159: Crash in WinClosed after BufUnload closes other windowsv9.1.0159zeertzjq
Problem: Crash in WinClosed after BufUnload closes other windows Solution: Don't trigger WinClosed if the buffer is NULL (zeertzjq) Now win_close_othertab() doesn't trigger any autocommands if the buffer is NULL, so remove the autocmd blocking above (which was added not long ago in patch v9.0.0550) for consistency. Also remove an unreachable close_last_window_tabpage() above: - It is only reached if only_one_window() returns TRUE and last_window() returns FALSE. - If only_one_window() returns TRUE, there is only one tabpage. - If there is only one tabpage and last_window() returns FALSE, the one_window() in last_window() must return FALSE, and the ONE_WINDOW in close_last_window_tabpage() must also be FALSE. - So close_last_window_tabpage() doesn't do anything and returns FALSE. Then the curtab != prev_curtab check also doesn't make much sense, and the only_one_window() can be replaced with a check for popup and a call to last_window() since this is a stricter check than only_one_window(). closes: #14166 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-28patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()v9.1.0143Christian Brabandt
Problem: [security]: autocmd cause use-after-free in set_curbuf() (kawarimidoll) Solution: check side-effect of BufLeave autocommand, when the number of windows changed, close windows containing buffers that will be wiped, if curbuf changed unexpectedly make sure b_nwindows is decremented otherwise it cannot be wiped set_curbuf() already makes some efforts to ensure the BufLeave autocommands do not cause issues. However there are still 2 issues that are not taken care of: 1) If a BufLeave autocommand opens a new window containing the same buffer as that is going got be closed in close_buffer() a bit later, we suddenly have another window open, containing a free'd buffer. So we must check if the number of windows changed and if it does (and the current buffer is going to be wiped (according to the 'bufhidden' setting), let's immediately close all windows containing the current buffer using close_windows() 2) If a BufLeave autocommand changes our current buffer (displays it in the current window), buf->b_nwindow will be incremented. As part of set_curbuf() we will however enter another buffer soon, which means, the newly created curbuf will have b_nwindows still have set, even so the buffer is no longer displayed in a window. This causes later problems, because it will no longer be possible to wipe such a buffer. So just before entering the final buffer, check if the curbuf changed when calling the BufLeave autocommand and if it does (and curbuf is still valid), decrement curbuf->b_nwindows. Both issues can be verified using the provided test (however the second issue only because such an impacted buffer won't be wiped, causing futher issues in later tests). fixes: #13839 closes: #14104 Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-15patch 9.1.0112: Remove undo information, when cleaning quickfix bufferv9.1.0112Christian Brabandt
Problem: When the quickfix buffer has been modified an autocommand may invalidate the undo stack (kawarimidoll) Solution: When clearing the quickfix buffer, also wipe the undo stack fixes: #13905 closes: #13928 Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-09patch 9.1.0088: TextChanged not triggered for :norm! commandsv9.1.0088Christian Brabandt
Problem: TextChanged not triggered for :norm! commands (machakann, after v9.0.2031) Solution: Only reset curbuf->b_last_changedtick if TextChangedI was triggered in insert mode (and not blocked) Note: for unknown reasons, the test fails on Windows (but seems to work fine when running interactively) fixes: #13967 closes: #13984 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>
2023-11-28patch 9.0.2135: No test for mode() when executing Ex commandsv9.0.2135zeertzjq
Problem: No test for mode() when executing Ex commands Solution: Add some test cases and simplify several other test cases. Also add a few more test cases for ModeChanged. closes: #13588 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-27patch 9.0.2075: TextChangedI may not always triggerv9.0.2075Christian Brabandt
Problem: TextChangedI may not always trigger Solution: trigger it in more cases: for insert/ append/change operations, and when opening a new line, fixes: #13367 closes: #13375 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2023-10-15patch 9.0.2031: TextChangedI may be triggered by non-insert mode changev9.0.2031Evgeni Chasnovski
Problem: `TextChangedI` can trigger on entering Insert mode if there was previously a change not in Insert mode. Solution: Make it trigger only when text is actually changed in Insert mode. closes: #13265 closes: #13338 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@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-09-09patch 9.0.1886: Various Typosv9.0.1886Christian Brabandt
Problem: Various Typos Solution: Fix Typos This is a collection of typo related commits. closes: #12753 closes: #13016 Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Viktor Szépe <viktor@szepe.net> Co-authored-by: nuid64 <lvkuzvesov@proton.me> Co-authored-by: Meng Xiangzhuo <aumo@foxmail.com> Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-04-26patch 9.0.1490: the ModeChanged event may be triggered too oftenv9.0.1490zeertzjq
Problem: The ModeChanged event may be triggered too often. Solution: Only trigger ModeChanged when no operator is pending. (closes #12298)
2023-04-15patch 9.0.1456: shortmess test depends on order of test executionv9.0.1456zeertzjq
Problem: Shortmess test depends on order of test execution. Solution: Clear messages. (closes #12264)
2023-02-11patch 9.0.1299: change for triggering incsearch not sufficiently testedv9.0.1299zeertzjq
Problem: Change for triggering incsearch not sufficiently tested. Solution: Add a test case. Simplify the code. (closes #11971)
2023-02-06patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChangedv9.0.1290zeertzjq
Problem: CTRL-N and -P on cmdline don't trigger CmdlineChanged. Solution: Jump to cmdline_changed instead of cmdline_not_changed. (closes #11956)
2023-01-28patch 9.0.1257: code style is not check in test scriptsv9.0.1257Bram Moolenaar
Problem: Code style is not check in test scripts. Solution: Add basic code style check for test files.
2023-01-17patch 9.0.1214: file left behind after running testsv9.0.1214Dominique Pelle
Problem: File left behind after running tests. Solution: Delete the file. (Dominique Pellé, closes #11839)
2022-12-31patch 9.0.1118: sporadic test failures when using a terminal windowv9.0.1118James McCoy
Problem: Sporadic test failures when using a terminal window. Solution: Adjust waiting times. (James McCoy, closes #11763)
2022-12-22patch 9.0.1087: autocommand test sometimes failsv9.0.1087James McCoy
Problem: Autocommand test sometimes fails. Solution: Add a short delay. (James McCoy, closes #11737)
2022-12-16patch 9.0.1064: code for making 'shortmess' temporarily empty is repeatedv9.0.1064Christian Brabandt
Problem: Code for making 'shortmess' temporarily empty is repeated. Solution: Add functions for making 'shortmess' empty and restoring it. (Christian Brabandt, closes #11709)
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-12-07patch 9.0.1025: WinScrolled is not triggered when filler lines changev9.0.1025zeertzjq
Problem: WinScrolled is not triggered when filler lines change. Solution: Add "topfill" to the values that WinScrolled triggers on. (closes #11668)
2022-12-05patch 9.0.1010: stray warnings for existing swap filesv9.0.1010Bram Moolenaar
Problem: Stray warnings for existing swap files. Solution: Wipe out the buffer until it has no name and no swap file.
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-25patch 9.0.0949: crash when unletting a variable while listing variablesv9.0.0949Bram Moolenaar
Problem: Crash when unletting a variable while listing variables. Solution: Disallow changing a hashtable while going over the entries. (closes #11435)
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-19patch 9.0.0913: only change in current window triggers the WinScrolled eventv9.0.0913Bram Moolenaar
Problem: Only a change in the current window triggers the WinScrolled event. Solution: Trigger WinScrolled if any window scrolled or changed size. (issue #11576)
2022-11-19patch 9.0.0909: error message for layout change does not match actionv9.0.0909Bram Moolenaar
Problem: Error message for layout change does not match action. Solution: Pass the command to where the error is given. (closes #11573)
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-18patch 9.0.0790: test for dummy buffer does not always produce the E86 errorv9.0.0790Bram Moolenaar
Problem: Test for dummy buffer does not always produce the E86 error. Solution: Do not check if the error is produced.
2022-10-18patch 9.0.0789: dummy buffer ends up in a windowv9.0.0789Bram Moolenaar
Problem: Dummy buffer ends up in a window. Solution: Disallow navigating to a dummy buffer.
2022-10-18patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-Cv9.0.0788Bram Moolenaar
Problem: ModeChanged autocmd not executed when Visual mode is ended with CTRL-C. Solution: Do not trigger the autocmd when got_int is set. (closes #11394)
2022-10-05patch 9.0.0663: tests check for +cmdwin feature which is always presentv9.0.0663zeertzjq
Problem: Tests check for +cmdwin feature which is always present. Solution: Remove the checks. (closes #11287)
2022-09-28patch 9.0.0614: SpellFileMissing autocmd may delete bufferv9.0.0614Bram Moolenaar
Problem: SpellFileMissing autocmd may delete buffer. Solution: Disallow deleting the current buffer to avoid using freed memory.
2022-09-23patch 9.0.0564: a few tests keep failing on MacOS M1v9.0.0564Bram Moolenaar
Problem: A few tests keep failing on MacOS M1. Solution: Add a test check CheckNotMacM1. Fix timer tests.
2022-09-22patch 9.0.0550: crash when closing a tabpage and buffer is NULLv9.0.0550zeertzjq
Problem: Crash when closing a tabpage and buffer is NULL. Solution: Adjust how autocommands are triggered when closing a window. (closes #11198, closes #11197)
2022-09-09patch 9.0.0428: autocmd test uses common file namev9.0.0428Bram Moolenaar
Problem: Autocmd test uses common file name. Solution: Use unique name to reduce flakiness.
2022-09-09patch 9.0.0425: autocmd test is a bit flaky on MS-Windowsv9.0.0425Bram Moolenaar
Problem: Autocmd test is a bit flaky on MS-Windows. Solution: Add a bit more sleeping. (Ken Takata, closes #11095)
2022-09-08patch 9.0.0415: on MS-Windows some tests are flakyv9.0.0415K.Takata
Problem: On MS-Windows some tests are flaky. Solution: Add sleeps, disable swapfile, mark test as flaky. (Ken Takata, closes #11082)
2022-09-07patch 9.0.0411: only created files can be cleaned up with one callv9.0.0411Bram Moolenaar
Problem: Only created files can be cleaned up with one call. Solution: Add flags to mkdir() to delete with a deferred function. Expand the writefile() name to a full path to handle changing directory.
2022-09-04patch 9.0.0380: deleting files in tests is a hassleBram Moolenaar
Problem: Deleting files in tests is a hassle. Solution: Use the new 'D' flag of writefile().
2022-09-02patch 9.0.0363: common names in test files causes tests to be flakyv9.0.0363Bram Moolenaar
Problem: Common names in test files causes tests to be flaky. Solution: Use more specific names.