aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd
Commit message (Collapse)AuthorAge
* fix(autocmds): once=true Lua event-handler may call itself #29544Felipe Vicentin2025-02-01
| | | | | | | | | | | | | | | | | | Problem: Event handler declared with `once=true` can re-trigger itself (i.e. more than once!) by calling `nvim_exec_autocmds` or `:doautocmd`. Analysis: This happens because the callback is executed before deletion/cleanup (`aucmd_del`). And calling `aucmd_del` before `call_autocmd_callback` breaks the autocmd execution... Solution: Set `ac->pat=NULL` to temporarily "delete" the autocmd, then restore it after executing the callback. Fix #25526 Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* feat(terminal)!: cursor shape and blink (#31562)Gregory Anders2024-12-17
| | | | | | | | | | | | | | | | | | | | | When a terminal application running inside the terminal emulator sets the cursor shape or blink status of the cursor, update the cursor in the parent terminal to match. This removes the "virtual cursor" that has been in use by the terminal emulator since the beginning. The original rationale for using the virtual cursor was to avoid having to support additional UI methods to change the cursor color for other (non-TUI) UIs, instead relying on the TermCursor and TermCursorNC highlight groups. The TermCursor highlight group is now used in the default 'guicursor' value, which has a new entry for Terminal mode. However, the TermCursorNC highlight group is no longer supported: since terminal windows now use the real cursor, when the window is not focused there is no cursor displayed in the window at all, so there is nothing to highlight. Users can still use the StatusLineTermNC highlight group to differentiate non-focused terminal windows. BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
* fix(api): generic error messages, not using TRY_WRAP #31596Justin M. Keyes2024-12-16
| | | | | | | | | | | Problem: - API functions using `try_start` directly, do not surface the underlying error message, and instead show generic messages. - Error-handling code is duplicated in the API impl. - Failure modes are not tested. Solution: - Use `TRY_WRAP`. - Add tests.
* test(autocmd/termxx_spec): fix TextChangedT test flakiness (#31296)zeertzjq2024-11-22
| | | | Problem: The E937 error appears for too short in TextChangedT test. Solution: Only feed an Enter key after seeing the error.
* docs: misc (#31138)dundargoc2024-11-21
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14
| | | | | | | | | | Before calling "attach" a screen object is just a dummy container for (row, col) values whose purpose is to be sent as part of the "attach" function call anyway. Just create the screen in an attached state directly. Keep the complete (row, col, options) config together. It is still completely valid to later detach and re-attach as needed, including to another session.
* test(autocmd/termxx_spec): properly setup TextChangedT tests (#30787)zeertzjq2024-10-13
|
* refactor(tests): rename terminal/testutil.lua => testterm.lua #30372Justin M. Keyes2024-09-15
| | | | | This module is generally used by any tests that need the full Nvim TUI instead of `screen.lua`. Thus it should live in `functional/` instead of in `functional/terminal/`.
* refactor(test): rename alter_slashes, invert its behaviorJustin M. Keyes2024-09-09
| | | | | | | - `alter_slashes` belongs in `testutil.lua`, not `testnvim.lua`. - `alter_slashes` is an unusual name. Rename it to `fix_slashes`. - invert its behavior, to emphasize that `/` slashes are the preferred, pervasive convention, not `\` slashes.
* refactor(tests): again yet more global highlight definitionsbfredl2024-08-14
|
* refactor: use `vim._with` where possibledundargoc2024-06-28
| | | | | This mostly means replacing `nvim_buf_call` and `nvim_win_call` with `vim._with`.
* feat(complete): specify reason for CompleteDoneFamiu Haque2024-05-24
| | | | | Problem: `CompleteDone` currently does not specify the reason for why completion was done, which is problematic for completion plugins as they cannot know whether the event was triggered due to the completion being canceled, accepted, or for some other reason. Solution: Add a `reason` key to `v:event`, which is set by `CompleteDone` to indicate why completion ended.
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* test: more tests for aucmd_win remaining floating (#28214)zeertzjq2024-04-07
|
* fix: adjust error message for error in UI event callback (#28200)zeertzjq2024-04-06
| | | | | | Also close Nvim instance before removing log file, otherwise the Nvim instance will still write to the log file. Also adjust log level in libuv_process_spawn(). Ref #27660
* vim-patch:9.1.0259: Normal mode TextChanged isn't tested properly (#28167)zeertzjq2024-04-04
| | | | | | | | | | 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: vim/vim#14396 https://github.com/vim/vim/commit/c422662933275484e61af79d8148898337a5c38e
* test: silence expected errorsdundargoc2024-04-02
| | | | This will remove unrelated errors in .nvimlog at the end of test output.
* vim-patch:9.1.0251: Filetype test fails (#28142)zeertzjq2024-04-01
| | | | | | | | | | | | | 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: vim/vim#14373 https://github.com/vim/vim/commit/8eb7523802cb51984e2202d08a4fbc1a2cd803c7 The changes to filetype.vim are N/A since Nvim always prefers filename matches to extension matches.
* vim-patch:9.1.0230: TextChanged autocommand not triggered under some ↵zeertzjq2024-04-01
| | | | | | | | | | | | | | circumstances (#28135) Problem: TextChanged autocommand not triggered under some circumstances (Sergey Vlasov) Solution: Trigger TextChanged when TextChangedI has not been triggered fixes: vim/vim#14332 closes: vim/vim#14339 https://github.com/vim/vim/commit/86032702932995db74fed265ba99ae0c823cb75d Co-authored-by: Christian Brabandt <cb@256bit.org>
* test: correct order of arguments to eq() (#27816)zeertzjq2024-03-11
|
* vim-patch:9.1.0158: 'shortmess' "F" flag doesn't work properly with 'autoread'zeertzjq2024-03-08
| | | | | | | | | | | | Problem: 'shortmess' "F" flag doesn't work properly with 'autoread' (after 9.1.0154) Solution: Hide the file info message instead of the warning dialog (zeertzjq) closes: vim/vim#14159 closes: vim/vim#14158 https://github.com/vim/vim/commit/8a01744c563f615ae7f6b3ab7f5208214a45a8e2
* refactor(tests): get channel id via nvim_get_chan_info #27441Justin M. Keyes2024-02-12
| | | Minor "best practices" nudge.
* vim-patch:9.1.0088: TextChanged not triggered for :norm! commands (#27405)zeertzjq2024-02-10
| | | | | | | | | | | | | | | | | | 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: vim/vim#13967 closes: vim/vim#13984 https://github.com/vim/vim/commit/c9e79e52845d51f48f5ea3753a62ab3fe0e40184 Cherry-pick test_autocmd.vim change from patch 8.2.4149. Co-authored-by: Christian Brabandt <cb@256bit.org>
* fix(events): check for WinResized/WinScrolled in terminal mode (#27226)zeertzjq2024-01-27
|
* test: use integers for API Buffer/Window/Tabpage EXT typesLewis Russell2024-01-16
|
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: normalise nvim bridge functionsLewis Russell2024-01-12
| | | | | - remove helpers.cur*meths - remove helpers.nvim
* test: typing for helpers.methsLewis Russell2024-01-12
|
* test: use vim.mpack and vim.uv directlyLewis Russell2024-01-12
|
* test: remove helpers.sleep()Lewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test: avoid repeated screen lines in expected stateszeertzjq2023-12-09
| | | | | | This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
* test: use termopen() instead of :terminal more (#26462)zeertzjq2023-12-08
|
* test: set notermguicolors in testsGregory Anders2023-12-06
| | | | | | Set 'notermguicolors' in tests which spawn a child Nvim process to force existing tests to use 16 colors. Also refactor the child process invocation to make things a little bit less messy.
* feat(highlight): update default color schemeEvgeni Chasnovski2023-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Default color scheme is suboptimal. Solution: Start using new color scheme. Introduce new `vim` color scheme for opt-in backward compatibility. ------ Main design ideas - Be "Neovim branded". - Be minimal for 256 colors with a bit more shades for true colors. - Be accessible through high enough contrast ratios. - Be suitable for dark and light backgrounds via exchange of dark and light palettes. ------ Palettes - Have dark and light variants. Implemented through exporeted `NvimDark*` and `NvimLight*` hex colors. - Palettes have 4 shades of grey for UI elements and 6 colors (red, yellow, green, cyan, blue, magenta). - Actual values are computed procedurally in Oklch color space based on a handful of hyperparameters. - Each color has a 256 colors variant with perceptually closest color. ------ Highlight groups Use: - Grey shades for general UI according to their design. - Bold text for keywords (`Statement` highlight group). This is an important choice to increase accessibility for people with color deficiencies, as it doesn't rely on actual color. - Green for strings, `DiffAdd` (as background), `DiagnosticOk`, and some minor text UI elements. - Cyan as main syntax color, i.e. for function usage (`Function` highlight group), `DiffText`, `DiagnosticInfo`, and some minor text UI elements. - Red to generally mean high user attention, i.e. errors; in particular for `ErrorMsg`, `DiffDelete`, `DiagnosticError`. - Yellow very sparingly only with true colors to mean mild user attention, i.e. warnings. That is, `DiagnosticWarn` and `WarningMsg`. - Blue very sparingly only with true colors as `DiagnosticHint` and some additional important syntax group (like `Identifier`). - Magenta very carefully (if at all). ------ Notes - To make tests work without relatively larege updates, each one is prepended with an equivalent of the call `:colorscheme vim`. Plus some tests which spawn new Neovim instances also now use 'vim' color scheme. In some cases tests are updated to fit new default color scheme.
* vim-patch:9.0.2134: ml_get error when scrolling (#26264)zeertzjq2023-11-29
| | | | | | | | | | | | | | | | | | | | | | | | Problem: ml_get error when scrolling after delete Solution: mark topline to be validated in main_loop if it is larger than current buffers line count reset_lnums() is called after e.g. TextChanged autocommands and it may accidentally cause curwin->w_topline to become invalid, e.g. if the autocommand has deleted some lines. So verify that curwin->w_topline points to a valid line and if not, mark the window to have w_topline recalculated in main_loop() in update_topline() after reset_lnums() returns. fixes: vim/vim#13568 fixes: vim/vim#13578 https://github.com/vim/vim/commit/c4ffeddfe5bd1824650e9b911ed9245bf56c69e3 The error doesn't happen in Nvim because Nvim triggers TextChanged after calling update_topline(). Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.0.2075: TextChangedI may not always trigger (#25808)zeertzjq2023-10-28
| | | | | | | | | | | | | Problem: TextChangedI may not always trigger Solution: trigger it in more cases: for insert/ append/change operations, and when opening a new line, fixes: vim/vim#13367 closes: vim/vim#13375 https://github.com/vim/vim/commit/4bca4897a12dfb91b3b27e3083fd5f370bd857d1 Co-authored-by: Christian Brabandt <cb@256bit.org>
* fix(terminal): assign channel to terminal earlier (#25771)zeertzjq2023-10-25
|
* test(autocmd/termxx_spec): fix flakiness (#25694)zeertzjq2023-10-18
|
* vim-patch:9.0.2031: TextChangedI may be triggered by non-insert mode change ↵zeertzjq2023-10-15
| | | | | | | | | | | | | | | (#25656) 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: vim/vim#13265 closes: vim/vim#13338 https://github.com/vim/vim/commit/d7ae263af8f6a2da55ce3702d18c53ab1418bca7 Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
* test(winscrolled): make sure floating window is drawn (#25639)zeertzjq2023-10-14
|
* fix(ui): trigger TabNewEntered after split new tabglepnir2023-10-07
|
* vim-patch:8.2.3517: TextChanged does not trigger after TextChangedI (#25384)zeertzjq2023-09-27
| | | | | | | | | Problem: TextChanged does not trigger after TextChangedI. Solution: Store the tick separately for TextChangedI. (Christian Brabandt, closes vim/vim#8968, closes vim/vim#8932) https://github.com/vim/vim/commit/db3b44640d69ab27270691a3cab8d83cc93a0861 Co-authored-by: Christian Brabandt <cb@256bit.org>
* test: add some tests for SafeState autocommandzeertzjq2023-08-21
|
* Merge #15440 close 'shell' :terminal automaticallyJustin M. Keyes2023-08-13
|\
| * test: update tests for auto-closing :term buffersGregory Anders2023-08-10
| | | | | | | | | | | | | | | | The terminal buffer closes automatically when using `:terminal` and the command exits without an error. This messes up some tests that expect the terminal buffer to still be open. We can force the buffer not to close by passing an argument to `:terminal`. This can be anything, since the shell-test stub simply prints whatever argument it's given.
* | fix(events): avoid unnecessary CursorMoved (#24675)zeertzjq2023-08-12
|/ | | | | | Problem: Temporarily changing current window in a script causes CursorMoved to be triggerd. Solution: Don't trigger CursorMoved if neither curwin nor cursor changed between two checks.
* test: check that TextChangedT cannot delete terminal buffer (#24437)zeertzjq2023-07-23
|