aboutsummaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAge
...
| * refactor(options): remove option type macrosFamiu Haque2023-12-14
| | | | | | | | | | | | | | | | Problem: We have `P_(BOOL|NUM|STRING)` macros to represent an option's type, which is redundant because `OptValType` can already do that. The current implementation of option type flags is also too limited to allow adding multitype options in the future. Solution: Remove `P_(BOOL|NUM|STRING)` and replace it with a new `type_flags` attribute in `vimoption_T`. Also do some groundwork for adding multitype options in the future. Side-effects: Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer gives an error.
* | vim-patch:323dda1484d9 (#26583)zeertzjq2023-12-15
|/ | | | | | | | | runtime(termdebug): add Tbreak command closes: vim/vim#13656 https://github.com/vim/vim/commit/323dda1484d95ee5c8a1b2205f8c495446df75ee Co-authored-by: iam28th <artyom28th@gmail.com>
* fix(extmark): only invalidate unpaired marks on deleted rowsLuuk van Baal2023-12-14
| | | | | | Problem: Unpaired marks are invalidated if its column is deleted, which may just be a "placeholder" column, e.g. for signs. Solution: Only remove unpaired marks if its entire row is deleted.
* test(nvim_open_term): don't resize after creating terminal (#26570)zeertzjq2023-12-14
| | | This makes the screen states consistently have no EOB lines.
* feat(nvim_open_term): convert LF => CRLF (#26384)Raphael2023-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Unlike termopen(), nvim_open_term() PTYs do not carriage-return the cursor on newline ("\n") input. nvim --clean :let chan_id = nvim_open_term(1, {}) :call chansend(chan_id, ["here", "are", "some", "lines"]) Actual behavior: here are some lines Expected behaviour: here are some lines Solution: Add `force_crlf` option, and enable it by default.
* fix(diagnostic): check for sign namespace instead of sign groupGregory Anders2023-12-13
|
* refactor(diagnostic): set sign by using extmark (#26193)Raphael2023-12-13
| | | | after sign implementation refactor by using extmark, we can use `nvim_buf_set_extmark` to set diagnostic sign instead use `sign_define`
* vim-patch:9.0.2159: screenpos() may crash with neg. column (#26542)zeertzjq2023-12-13
| | | | | | | | Problem: screenpos() may crash with neg. column Solution: validate and correct column closes: vim/vim#13669 https://github.com/vim/vim/commit/ec54af4e26952d954a4cc009f62c80ea01445d30
* feat(iter): add `Iter.take` (#26525)Will Hopkins2023-12-12
|
* fix(stream): do not close handle if it is already closing (#26537)Gregory Anders2023-12-12
| | | | | uv_close asserts that a handle is not already closing. We can guard against this assertion failure by manually checking the handle's closing status ourselves.
* fix(lua): memory leak when using invalid syntax with exists() (#26530)zeertzjq2023-12-12
|
* feat(eval): exists() function supports checking v:lua functions (#26485)Raphael2023-12-12
| | | | Problem: Vimscript function exists() can't check v:lua functions. Solution: Add support for v:lua functions to exists().
* Merge pull request #26486 from glepnir/fix_linebytebfredl2023-12-12
|\ | | | | fix(eval): use no_ff instead of ffdos as condition
| * fix: use no_ff instead of ffdos as conditionglepnir2023-12-12
| | | | | | | | | | | | | | | | Problem: line2byte behavior is changed after commit b051b13. It no longer return `-1` on empty buffer. Solution: use `nof_ff` instead of `!ff_dos` as condition. Then compatible behavior of line2byte() is restored.
* | test(treesitter/fold_spec): fix flakiness (#26524)zeertzjq2023-12-12
| |
* | fix(tui): don't forget to update cursor visibility (#26523)zeertzjq2023-12-12
| |
* | Merge pull request #26506 from tomtomjhj/tsfoldLewis Russell2023-12-11
|\ \ | | | | | | fix(treesitter): improve vim.treesitter.foldexpr
| * | test(treesitter): more foldexpr testsJaehwang Jung2023-12-12
| | |
* | | Merge pull request #26458 from famiu/refactor/options/optionindexdundargoc2023-12-10
|\ \ \
| * | | refactor(options): reduce `findoption()` usageFamiu Haque2023-12-09
| |/ / | | | | | | | | | | | | | | | Problem: Many places in the code use `findoption()` to access an option using its name, even if the option index is available. This is very slow because it requires looping through the options array over and over. Solution: Use option index instead of name wherever possible. Also introduce an `OptIndex` enum which contains the index for every option as enum constants, this eliminates the need to pass static option names as strings.
* | | test: make text-only snapshots work (#26494)zeertzjq2023-12-10
| | |
* | | 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: allow avoiding repeated screen lines in expected stateszeertzjq2023-12-09
|/ / | | | | | | | | | | | | | | | | | | | | | | Allow a "*count" suffix in a screen line to repeat the screen line for "count" times. The change is made to Screen:expect() and Screen:get_snapshot() instead of Screen:render() so that screen expectations generated using code can still work and test failures can still be readable. A snapshot is now also printed on failure so that there is no need to run the test again with Screen:snapshot_util().
* | 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>