aboutsummaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAge
...
* | refactor(tui): use synchronized updates around actual buf flush (#26478)Gregory Anders2023-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | Rather than writing the synchronized update begin and end sequences into the TUI's internal buffer (where it is later flushed to the TTY), write these sequences directly to the TTY before and after the TUI's internal buffer is itself flushed to the TTY. This guarantees that a synchronized update is always used when we are actually sending data to the TTY. This means we do not need to keep track of the TUI's "dirty" state (any sequences which affect the TUI state will be written in the TUI's internal buffer, which is now guaranteed to only ever be written when a synchronized update is active).
* | vim-patch:9.0.2154: The option[] array is not sorted (#26475)zeertzjq2023-12-09
| | | | | | | | | | | | | | | | | | | | | | Problem: The options[] array is not sorted alphabetically. Solution: Sort it alphabetically. Add a test. Avoid unnecessary loop iterations in findoption(). closes: vim/vim#13648 Cherry-pick Test_set_one_column() change from patch 8.2.0432. https://github.com/vim/vim/commit/f48558e10a08a1a483e25ef847bbceeac6b44561
* | perf(column): avoid counting when max signs are removed from a rangeLuuk van Baal2023-12-08
| |
* | test(tui_spec): update cursor_address test for flush start (#26464)zeertzjq2023-12-08
| |
* | test: use termopen() instead of :terminal more (#26462)zeertzjq2023-12-08
| |
* | test: fix Windows tests failures (#26461)Gregory Anders2023-12-08
| |
* | Merge pull request #26456 from gpanders/ignore-vim-runtimeGregory Anders2023-12-07
|\ \ | | | | | | fix(terminal): ignore $VIM and $VIMRUNTIME in pty jobs
| * | test: forward $VIMRUNTIME in child nvim instancesGregory Anders2023-12-07
| | |
* | | fix(lua): allow nil values in serialized Lua arrays (#26329)Gregory Anders2023-12-07
|/ / | | | | | | | | | | | | | | | | | | | | When we convert a Lua table to an Object, we consider the table a "dictionary" if it contains only string keys, and an array if it contains all numeric indices with no gaps. While rare, Lua tables can have both strictly numeric indices and gaps (e.g. { [2] = 2 }). These currently cannot be serialized because it is not considered an array. However, we know the maximum index of the table and as long as all of the keys in the table are numeric, it is still possible to serialize this table as an array. The missing indices will have nil values.
* | perf(column): keep track of number of lines that hold up the 'signcolumn'Luuk van Baal2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The entire marktree needs to be traversed each time a sign is removed from the sentinel line. Solution: Remove sentinel line and instead keep track of the number of lines that hold up the 'signcolumn' in "max_count". Adjust this number for added/removed signs, and set it to 0 when the maximum number of signs on a line changes. Only when "max_count" is decremented to 0 due to sign removal do we need to check the entire buffer. Also replace "invalid_top" and "invalid_bot" with a map of invalid ranges, further reducing the number of lines to be checked. Also improve tree traversal when counting the number of signs. Instead of looping over the to be checked range and counting the overlap for each row, keep track of the overlap in an array and add this to the count.
* | feat(rpc): allow empty string key in msgpack => Vim conversionJustin M. Keyes2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Since e057b38e7037 #20757 we support empty key in JSON encode/decode, but we don't allow it in RPC object => Vim dict conversion. But empty string is a valid key in Vim dicts and the msgpack spec. Empty string key was disallowed in 7c01d5ff9286 (2014) but that commit/PR doesn't explicitly discuss it, so presumably it was a "seems reasonable" decision (or Vimscript didn't allow empty keys until later). Solution: Remove the check in `object_to_vim()`. Note that `tv_dict_item_alloc_len` will invoke `memcpy(…, 0)` but that's allowed by the C spec: https://stackoverflow.com/a/3751937/152142
* | fix(terminal): never propagate $COLORTERM from outer env (#26440)zeertzjq2023-12-07
| | | | | | | | If $COLORTERM is "truecolor" but the user sets 'notermguicolors', propagating $COLORTERM to :terminal usually doesn't work well.
* | test(unit): correct header name (#26446)zeertzjq2023-12-07
| |
* | test(inccommand_spec): actually trigger 'inccommand' previewzeertzjq2023-12-07
| |
* | fix(inccommand): save and restore '[ and '] marks (#26442)zeertzjq2023-12-07
| | | | | | | | Undoing a change moves '[ and '] marks, so it is necessary to save and restore them.
* | test: set 'termguicolors' in outer Nvim instance (#26437)zeertzjq2023-12-07
| | | | | | | | | | | | | | | | | | | | Currently, the value of $COLORTERM in :terminal in tests depends on outer environment because of 'notermguicolors'. If $COLORTERM is not set in :terminal, an inner Nvim instance will try to detect 'termguicolors' support, which may interfere with tests. So set 'termguicolors' in outer Nvim instance unless $COLORTERM needs to be overridden, and unset it in inner Nvim instance when running TUI.
* | test(terminal): remove unnecessary string operations (#26434)zeertzjq2023-12-07
| |
* | Merge pull request #26381 from bfredl/delaycolorsbfredl2023-12-06
|\ \ | | | | | | fix(startup): only send one default_colors_set event during startup
| * | fix(startup): only send one default_colors_set event during startupbfredl2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the color scheme is changed in a startup script, nvim used to send multiple default_colors_set events, one for the default color scheme and one for the user's chosen color scheme. This would cause flicker in some UI:s. Throttle this event until we actually start drawing on the screen. fixes #26372
* | | Merge pull request #26407 from gpanders/default-tgcGregory Anders2023-12-06
|\ \ \ | | | | | | | | feat(defaults): enable 'termguicolors' by default when supported by terminal
| * | | 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.
* | | | test: unreliable 'nofsync' test #26423Justin M. Keyes2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Followup to 27501d3b6a8d577cf3f5ecc3fe9e219f477586b7. Problem: CI sometimes fails. Something is triggering an extra fsync(). FAILED test/functional/core/fileio_spec.lua @ 52: fileio fsync() with 'nofsync' #8304 test/functional/core/fileio_spec.lua:100: Expected objects to be the same. Passed in: (number) 5 Expected: (number) 4 Solution: Relax the assertion.
* | | | fix(json): allow objects with empty keys #25564Emanuel2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Empty string is a valid JSON key, but json_decode() treats an object with empty key as ":help msgpack-special-dict". #20757 :echo json_decode('{"": "1"}') {'_TYPE': [], '_VAL': [['', '1']]} Note: vim returns `{'': '1'}`. Solution: Allow empty string as an object key. Note that we still (currently) disallow empty keys in object_to_vim() (since 7c01d5ff9286d262097484c680e3a4eab49e2911): https://github.com/neovim/neovim/blob/f64e4b43e1191ff30d902730f752875aa55682ce/src/nvim/api/private/converter.c#L333-L334 Fix #20757 Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* | | | test: 'nofsync' with deadly signal #26415Justin M. Keyes2023-12-06
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The test for 'nofsync' swapfile preservation on a deadly signal, does not actually assert anything. followup to 1fd29a28841dee3d25ff079eb24fc160eb02cb3c Solution: Check that swapfile contents are present after getting SIGTERM. TODO: this doesn't really verify that 'fsync' was called; it still passes with this patch: diff --git a/src/nvim/main.c b/src/nvim/main.c index 216e39f3e81c..7a635520401d 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -838,7 +838,7 @@ void preserve_exit(const char *errmsg) if (errmsg != NULL) { os_errmsg("Vim: preserving files...\r\n"); } - ml_sync_all(false, false, true); // preserve all swap files + ml_sync_all(false, false, false); // preserve all swap files break; } } However it correctly fails with this patch, at least: diff --git a/src/nvim/main.c b/src/nvim/main.c index 216e39f3e81c..f2306c310ddc 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -838,7 +838,6 @@ void preserve_exit(const char *errmsg) if (errmsg != NULL) { os_errmsg("Vim: preserving files...\r\n"); } - ml_sync_all(false, false, true); // preserve all swap files break; } }
* | | vim-patch:8.2.3695: confusing error for missing key (#26420)zeertzjq2023-12-06
|/ / | | | | | | | | | | | | | | Problem: Confusing error for missing key. Solution: Use the actualy key for the error. (closes vim/vim#9241) https://github.com/vim/vim/commit/5c1ec439f0a69e9aa7ece9bbb7d916f48f58be1e Co-authored-by: Bram Moolenaar <Bram@vim.org>
* | feat(lua): implement Iter:join() (#26416)Gregory Anders2023-12-05
| |
* | docs: small fixes (#26243)dundargoc2023-12-06
| | | | | | | | | | Co-authored-by: umlx5h <umlx5h21@protonmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Evan Farrar <evan@evanfarrar.com>
* | vim-patch:9.0.2151: 'breakindent' is not drawn after diff filler lines (#26412)zeertzjq2023-12-06
| | | | | | | | | | | | | | | | | | | | Problem: 'breakindent' is not drawn after diff filler lines. Solution: Correct check for whether 'breakindent' should be drawn. closes: vim/vim#13624 https://github.com/vim/vim/commit/588f20decebebedba3ad733f4f443a597e9747c3 Cherry-pick Test_diff_with_syntax() change from patch 9.0.1257.
* | test: fileio_spec is unreliable/flaky #26404Justin M. Keyes2023-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: CI sometimes fails. Something is triggering an extra fsync(). FAILED test/functional/core/fileio_spec.lua @ 52: fileio fsync() codepaths #8304 test/functional/core/fileio_spec.lua:87: Expected objects to be the same. Passed in: (number) 3 Expected: (number) 2 stack traceback: test/functional/core/fileio_spec.lua:87: in function <test/functional/core/fileio_spec.lua:52> Solution: Relax the assertion to `fsync >= 2` instead of exactly 2. (Note this is not a behavior change: the next assertion has always checked `fsync == 4`, it's just that the intermediate 3rd fsync was never explicitly asserted.)
* | Merge pull request #26361 from luukvbaal/invalidbfredl2023-12-05
|\ \ | |/ |/| fix(extmarks): restore old position before revalidating
| * fix(extmarks): restore old position before revalidatingLuuk van Baal2023-12-02
| |
* | refactor(api): complete conversion from `Dictionary` to `Dict(opts)` (#26365)Riccardo Mazzarini2023-12-05
| |
* | vim-patch:9.0.2148: Vim does not detect pacman.log fileChristian Clason2023-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Vim does not detect pacman.log file Solution: Detect pacmanlogs and add syntax highlighting pacman.log is a filetype common to Arch Liux and related distributions. Add some simple syntax highlighting for the pacmanlog filetype. closes: vim/vim#13618 https://github.com/vim/vim/commit/1e5d66408ef85c750a5af03bbf5cc19b5de7a6bc Co-authored-by: Ronan Pigott <ronan@rjp.ie>
* | fix(change): update fold after on_bytes (#26364)Jaehwang Jung2023-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: With vim.treesitter.foldexpr, `o`-ing two lines above a folded region opens the fold. This does not happen with legacy foldexprs. For example, make a markdown file with the following text (without indentation), enable treesitter fold, and follow the instruction in the text. put cursor on this line and type zoo<Esc> initially folded, revealed by zo # then this fold will be opened initially folded, revealed by o<Esc> Analysis: * `o` updates folds first (done in `changed_lines`), evaluating foldexpr, and then invokes `on_bytes` (done in `extmark_splice`). * Treesitter fold allocates the foldinfo for added lines (`add_range`) on `on_bytes`. * Therefore, when treesitter foldexpr is invoked while running `o`, it sees outdated foldinfo. Solution: `extmark_splice`, and then `changed_lines`. This seems to be the standard order in other places, e.g., `nvim_buf_set_lines`.
* | build: enable lintlua for test/unit/ dir #26396Justin M. Keyes2023-12-04
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Not all Lua code is checked by stylua. Automating code-style is an important mechanism for reducing time spent on accidental (non-essential) complexity. Solution: - Enable lintlua for `test/unit/` directory. - TODO: only `test/functional/` remains unchecked. previous: 45fe4d11add933df76a2ea4bf52ce8904f4a778b previous: 517f0cc634b985057da5b95cf4ad659ee456a77e
* | fix(treesitter): allow passing lang to vim.treesitter.get_node() now ↵Jongwook Choi2023-12-04
| | | | | | | | | | | | | | | | | | | | correctly takes opts.lang (#26360) PROBLEM: `vim.treesitter.get_node()` does not recognize the `lang` in the option table. This option was used in somewhere else, for instance, `vim.treesitter.dev` (for `inspect_tree`) but was never implemented. SOLUTION: Make `get_node()` correctly use `opts.lang` when getting a treesitter parser.
* | vim-patch:9.0.2145: wrong scrolling in insert mode with smoothscroll (#26375)zeertzjq2023-12-04
| | | | | | | | | | | | | | | | | | | | Problem: Wrong scrolling in Insert mode with 'smoothscroll' at the bottom of the window. Solution: Don't use set_topline() when 'smoothscroll' is set. fixes: vim/vim#13612 closes: vim/vim#13613 https://github.com/vim/vim/commit/5b4d1fcbf06757bae32a894871b9a649c84eba7f
* | feat(treesitter): highlight help files by default (#26347)Christian Clason2023-12-03
| |
* | 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.2143: [security]: buffer-overflow in ex_substitutezeertzjq2023-12-02
| | | | | | | | | | | | | | | | | | | | | | Problem: [security]: buffer-overflow in ex_substitute Solution: clear memory after allocating When allocating the new_start pointer in ex_substitute() the memory pointer points to some garbage that the following for loop in ex_cmds.c:4743 confuses and causes it to accessing the new_start pointer beyond it's size, leading to a buffer-overlow. So fix this by using alloc_clear() instead of alloc(), which will clear the memory by NUL and therefore cause the loop to terminate correctly. Reported by @henices, thanks! closes: vim/vim#13596 https://github.com/vim/vim/commit/abfa13ebe92d81aaf66669c428d767847b577453 Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.0.2142: [security]: stack-buffer-overflow in option callback ↵zeertzjq2023-12-02
| | | | | | | | | | | | | | | | | | | | | functions Problem: [security]: stack-buffer-overflow in option callback functions Solution: pass size of errbuf down the call stack, use snprintf() instead of sprintf() We pass the error buffer down to the option callback functions, but in some parts of the code, we simply use sprintf(buf) to write into the error buffer, which can overflow. So let's pass down the length of the error buffer and use sprintf(buf, size) instead. Reported by @henices, thanks! https://github.com/vim/vim/commit/b39b240c386a5a29241415541f1c99e2e6b8ce47 Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.0.2141: [security]: buffer-overflow in suggest_trie_walkzeertzjq2023-12-02
| | | | | | | | | | | | | | | Problem: [security]: buffer-overflow in suggest_trie_walk Solution: Check n before using it as index into byts array Basically, n as an index into the byts array, can point to beyond the byts array. So let's double check, that n is within the expected range after incrementing it from sp->ts_curi and bail out if it would be invalid. Reported by @henices, thanks! https://github.com/vim/vim/commit/0fb375aae608d7306b4baf9c1f906961f32e2abf Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.0.2140: [security]: use-after-free in win-enterzeertzjq2023-12-02
| | | | | | | | | | | | | | | | | | | Problem: [security]: use-after-free in win-enter Solution: validate window pointer before calling win_enter() win_goto() may stop visual mode, if it is active. However, this may in turn trigger the ModeChanged autocommand, which could potentially free the wp pointer which was valid before now became stale and points to now freed memory. So before calling win_enter(), let's verify one more time, that the wp pointer still points to a valid window structure. Reported by @henices, thanks! https://github.com/vim/vim/commit/eec0c2b3a4cfab93dd8d4adaa60638d47a2bbc8a Co-authored-by: Christian Brabandt <cb@256bit.org>
* revert: "memory: Free buffers after freeing variables" (#26356)zeertzjq2023-12-02
| | | | | | | | | This reverts commit fe30d8ccef17fff23676b8670dfec86444e2cb32. The original commit intends to prevent heap-use-after-free with EXITFREE caused by changedtick_di, which is no longer a problem. Freeing buffers after freeing variables will cause heap-use-after-free with EXITFREE when a partial is used as prompt callback.
* vim-patch:9.0.2139: html.angular ft is problematic (#26357)zeertzjq2023-12-02
| | | | | | | | | | | | | | | | | | Problem: html.angular ft is problematic Solution: partly revert v9.0.2137 The html.angular filetype causes issues and does not trigger FileType autocommands for the html or angular filetypes. So let's roll back that particular change and detect this only as html file related: https://github.com/vim/vim/pull/13594#issuecomment-1834465890 closes: vim/vim#13604 https://github.com/vim/vim/commit/4f3480c94358e3b938594fc3574477e780525cd7 Co-authored-by: Christian Brabandt <cb@256bit.org>
* refactor: change event_create() to a macro (#26343)zeertzjq2023-12-01
| | | A varargs functions can never be inlined, so a macro is faster.
* fix(api): use a conditional stack for nvim_cmd (#26341)zeertzjq2023-12-01
|
* vim-patch:9.0.2137: Can't detect angular & mustache filetypesObserverOfTime2023-11-30
| | | | | | | | | | Problem: Can't detect angular & mustache filetypes Solution: Detect *.mustache as Mustache filetype; detect *.component.html as html.angular filetype closes: vim/vim#13594 https://github.com/vim/vim/commit/7bed263c343c62129c5d8f51796895a28db1b312
* fix(tui): grow termkey's internal buffer for large escape sequences (#26309)Gregory Anders2023-11-30
| | | | | | Some escape sequences (in particular, OSC 52 paste responses) can be very large, even unbounded in length. These can easily overflow termkey's internal buffer. In order to process these long sequences, dynamically grow termkey's internal buffer.
* Merge pull request #23657 from luukvbaal/extmarkbfredl2023-11-30
|\ | | | | fix(extmark): restore extmarks when completing original text