This covers all "small" inserts and deletes in insert mode, as well
as a few more cases like small normal mode deletes
vim-patch:8.1.0678: text properties as not adjusted for inserted text
NB: this is not the final implementation. Bufhl should be made a
part of the extmark tree, so that "start" adjustment just works
automatically. But "stop" will still need some ad-hoc trickery,
until extended marks natively support ranges (hopefully sooner than
forever).
* Clear 'cc' in nvim_open_win 'minimal' style #11361
Add 'colorcolumn' to the list of options that should be cleared when creating
a 'minimal'-style floating window.
- Use correct implementation of text_edits.
- Send indent options to rangeFormatting and formatting.
- Remove references to vim bindings and filetype from lsp.txt
- Add more examples to docs.
- Add before_init to allow changing initialize_params.
Problem: Using a full path is supported for 'directory' but not for
'backupdir'. (Mikolaj Machowski)
Solution: Support 'backupdir' as well. (Christian Brabandt, closesvim/vim#179)
b782ba475a
Mainly configuration and RPC infrastructure can be considered "done". Specific requests and their callbacks will be improved later (and also served by plugins). There are also some TODO:s for the client itself, like incremental updates.
Co-authored by at-tjdevries and at-h-michael, with many review/suggestion contributions.
We often want to do type checking of public function arguments.
- test: Rename utility_function_spec.lua to vim_spec.lua
- .luacov: Map lua module names
compared to vim.api.|nvim_call_function|, this fixes some typing issues
due to the indirect conversion via the API. float values are preserved
as such (fixes#9389) as well as empty dicts/arrays.
Ref https://github.com/norcalli/nvim.lua for the call syntax
- Running out of retries, or unexpected screen state should make the
test FAIL, not ERROR.
- Uses levels to report the location of the caller.
- Improve message with retry-failure (formatting).
Before:
[ RUN ] test: 103.53 ms ERR
test/functional/helpers.lua:388:
retry() attempts: 1
test/functional/ui/screen.lua:587: Row 1 did not match.
Expected:
|*X^ |
|{0:~ }|
|{0:~ }|
| |
Actual:
|*^ |
|{0:~ }|
|{0:~ }|
| |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/helpers.lua:388: in function 'retry'
test/functional/test_spec.lua:24: in function <test/functional/test_spec.lua:23>
After:
[ RUN ] test: 105.22 ms FAIL
test/functional/test_spec.lua:24: stopping after 1 retry() attempts.
test/functional/test_spec.lua:25: Row 1 did not match.
Expected:
|*X^ |
|{0:~ }|
|{0:~ }|
| |
Actual:
|*^ |
|{0:~ }|
|{0:~ }|
| |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/helpers.lua:389: in function 'retry'
test/functional/test_spec.lua:24: in function <test/functional/test_spec.lua:23>
It is perfectly fine and expected to detach from the screen just by
the UI disconnecting from nvim or exiting nvim. Just keep detach() in
screen_basic_spec, to get some coverage of the detach method itself.
This avoids hang on failure in many situations (though one could argue
that detach() should be "fast", or at least "as fast as resize",
which works in press-return already).
Never use detach() just to change the size of the screen, try_resize()
method exists for that specifically.
PR #8221 took a short-cut when implementing the tests: screen.lua would
translate the linegrid highlight ids back into the old per-cell
attribute description.
Apart from cleaning up technical debt, this enables to check both rgb
and cterm colors in the same expect(), which previously was needlessly
restricted to ext_hlstate tests only.
- Test fnamemodify()
- Test handling of `expand("%:e:e:r")`.
- Fix :e:e:r on filenames with insufficiently many extensions
During `fnamemodify()`, ensuring that we don't go before the filename's
tail is insufficient in cases where we've already handled a ":e"
modifier, for example:
```
"path/to/this.file.ext" :e:e:r:r
^ ^-------- *fnamep
+------------- tail
```
This means for a ":r", we'll go before `*fnamep`, and outside the bounds
of the filename. This is both incorrect and causes neovim to exit with
an allocation error.
We exit because we attempt to calculate `s - *fnamep` (line 23948).
Since `s` is before `*fnamep`, we caluclate a negative length, which
ends up being interpreted as an amount to allocate, causing neovim to
exit with ENOMEM (`memory.c:xmalloc`).
We must instead ensure we don't go before `*fnamep` nor `tail`.
The check for `tail` is still relevant, for example:
```
"path/to/this.file.ext" :r:r:r
^ ^------------- tail
+--------------------- *fnamep
```
Here we don't want to go before `tail`.
close#11165
Meant to fix:
[ ERROR ] test/functional/terminal/tui_spec.lua @ 925: TUI FocusGained/FocusLost in terminal-mode
test/functional/ui/screen.lua:587: Row 6 did not match.
Expected:
|{1:r}eady $ |
|[Process exited 0] |
| |
| |
| |
|*gained |
|{3:-- TERMINAL --} |
Actual:
|{1:r}eady $ |
|[Process exited 0] |
| |
| |
| |
|*:terminal |
|{3:-- TERMINAL --} |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/ui/screen.lua:587: in function '_wait'
test/functional/ui/screen.lua:370: in function 'expect'
test/functional/terminal/tui_spec.lua:934: in function <test/functional/terminal/tui_spec.lua:925>
I've thought about adding this, but it might not be really relevant, and
slows down the tests a bit (and a warning "warning: Screen test
succeeded immediately" with another test):
```diff
diff --git i/test/functional/terminal/tui_spec.lua w/test/functional/terminal/tui_spec.lua
index ada073c4e..4bc2ab4e0 100644
--- i/test/functional/terminal/tui_spec.lua
+++ w/test/functional/terminal/tui_spec.lua
@@ -818,6 +818,11 @@ describe('TUI FocusGained/FocusLost', function()
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]')
feed_data(":autocmd FocusGained * echo 'gained'\n")
feed_data(":autocmd FocusLost * echo 'lost'\n")
+ -- Wait for autocommand to be registered.
+ retry(nil, nil, function()
+ feed_data(":autocmd FocusLost\n")
+ screen:expect{any=" echo 'lost'"}
+ end)
feed_data("\034\016") -- CTRL-\ CTRL-N
end)
```
* handle_background_color: short-circuit if handled already
* Unit tests for handle_background_color
* set waiting_for_bg_response to false in tui_terminal_after_startup
By then it should have been received.
* mode_spec: retry with increasing matchtime
`matchtime=2` might still be too low (with luacov on AppVeyor).
[ ERROR ] test/functional\ui\mode_spec.lua @ 47: ui mode_change event works in insert mode
test\functional\ui\screen.lua:587: mode
Expected objects to be the same.
Passed in:
(string) 'insert'
Expected:
(string) 'showmatch'
Hint: full state of "mode":
"insert"
Followup to fe60013fb.
ref #10941
Initially regressed in 7ed2122622
``
* ui/screen_basic_spec: set timeoutlen=10000
This fixes the test on slow CI.
Ref: https://ci.appveyor.com/project/neovim/neovim/builds/27600387/job/t468h2b3w9lwtlm5#L10930
Doing the screen test first might give insights about a possible
(flaky?) failure, where it looks like "feed_data" is processed out of
order:
[ ERROR ] test/functional/terminal/tui_spec.lua @ 561: TUI paste: exactly 64 bytes #10311
test/functional/helpers.lua:388:
retry() attempts: 490
test/functional/terminal/tui_spec.lua:66: Expected objects to be the same.
Passed in:
(table: 0x44042de8) {
*[1] = ' endzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz' }
Expected:
(table: 0x41d6e568) {
*[1] = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz end' }
stack traceback:
test/functional/helpers.lua:388: in function 'retry'
test/functional/terminal/tui_spec.lua:63: in function 'expect_child_buf_lines'
test/functional/terminal/tui_spec.lua:569: in function <test/functional/terminal/tui_spec.lua:561>
Ref: https://github.com/neovim/neovim/pull/11083#issuecomment-534375201
Build log: https://travis-ci.org/neovim/neovim/jobs/588749739#L5597
Previously, the "precedes" character would be rendered on every row
when w_skipcol > 0 (i.e., when viewing a single line longer than the
entire screen), instead of just on the first row. Make sure to only
render it on the first row in this case.
Add a test for this behavior.
Fix documentation for the "precedes" character, which erroneously
stated that it was only active when wrap mode was off.
This release represents ~2700 commits since v0.3.4, the previous
non-maintenance release. Besides the highlights listed below, this
release features vast improvements to documentation, internal subsystems
and test/CI infrastructure, and 700+ patches merged from Vim.
FEATURES:
New API functions:
nvim_create_buf: create various kinds of buffers
nvim_get_context, nvim_load_context
8e6b0a73c9#10619 API: Context: save/restore/inspect editor state
nvim_input_mouse: perform mouse actions
nvim_open_win: create floating windows (and external, for supporting UIs)
nvim_paste: paste text at cursor
nvim_put: put text at cursor
nvim_select_popupmenu_item: perform popupmenu actions
nvim_set_keymap: create/delete mappings
nvim_set_vvar: set v: variables
nvim_ui_pum_set_height
nvim_ui_try_resize_grid
nvim_win_close: close windows
nvim_win_get_config: get window configuration
nvim_win_set_config: reconfigure windows
New UI events:
redraw.grid_destroy
redraw.hl_group_set
8a3f8589a3#10504 UI/highlight: expose builtin highlight groups using hl_group_set event
redraw.msg_clear
redraw.msg_history_show
redraw.msg_ruler
redraw.msg_set_pos
redraw.msg_show
redraw.msg_showcmd
redraw.msg_showmode
redraw.win_close
redraw.win_external_pos
redraw.win_float_pos
redraw.win_hide
redraw.win_pos
API
f5c56f03bb#9170 API/Lua: nvim_buf_attach: support Lua callback
82d48c0dab#9896 API: emit nvim_error_event on failed async request
b9ad12e6c2#9992 UI/nvim_ui_attach(): add `override` option
3d1ed7c959#9993 UI/ext_messages: learn more message kinds
8ed54bbec3#9547 proper multiline error message for rpcrequest, API wrappers
Lua
This release introduces "Nvim-Lua standard library". See ":help lua-stdlib".
89d7e24891#9463 Lua stdlib: vim.inspect, string functions
8e941c59ec#9740 Lua: generate documentation from docstrings
1cbe014569#9301 lua/stdlib: Introduce vim.shared
c83926cd0a#10123 Lua: introduce vim.loop (expose libuv event-loop)
81e1dbca99#10120 Lua: vim.schedule(cb)
1f54f68732#10688 Lua: minimal UTF-16 support needed for LSP
6fb0020df4#10513 Lua encoding support
c0993ed343 Lua: support getting UTF-32 and UTF-16 sizes of replaced text
b0e26199ec Lua: add {old_byte_size} to on_lines buffer change event
UI:
- The Nvim 0.3.4 UI protocol introduced line-based updates instead of
legacy char-based updates. Nvim 0.4 continues to evolve the UI
protocol. See ":help ui". Legacy UI clients are supported. See
":help api-contract".
9a1675b065#6619 Floating windows
- Can be (re)positioned, anchored, external.
- Are real windows showing real buffers. No shortcuts, hacks, or compromises.
- Support all features and API of normal windows, plus more.
6427894d89#8455 Multigrid: "windows drawn on separate grids"
- Windows are logically isolated internally.
- Windows are sent to UIs as distinct objects, so that UIs can control
layout instead of being stuck with the classic TUI layout.
- Per-window font-size, dimenions, line-spacing.
- Compositor: Internal subsystem for composing grids.
3855204f58#6917 UIEnter, UILeave
788bcbba24#9923 ui: ":syn blend=", 'winblend'
7cf7c0a0b8#9575 ui: 'redrawdebug' option for flexible debugging of redrawing
5c836d2ef8#9607 wildoptions=pum (enabled by default)
37f8df8824#9571 UI: 'pumblend' option for semi-transparent popupmenu
c403a95a52#9446 Visual: highlight char-at-cursor
- Traditionally Vim's visual selection does "reverse mode", which
perhaps conflicts with the non-blinking block cursor. But
'guicursor' defaults to a vertical bar for selection=exclusive, and
this confuses users who expect to see the text highlighted.
:terminal
fc27dc98d7#8550 autocmds: TermEnter, TermLeave
d13803f64f#9810 keymap, terminal: more keycodes
3b56f59532#9535 :terminal : Fix F1-F4 key codes
2d4a37ebab#10370 :ls : show "R", "F" for terminal-jobs
fd0fd752c8#9966 terminal: swap priority of terminal, editor highlights
7bb858c39c#9494 libvterm 0.1
TUI
3afb397407 syntax, TUI: support "strikethrough"
ccbcd390d4#9408 TUI: "title stacking" unconditionally
298608f88c#9509 TUI: detect background color, set bg=dark/light
42f492ac99#9097 TUI: handle Smulx extension capability (extended underline)
424ddd01f5#10205 TUI: support rgba background detection
9b4383261a#9601 TUI: italics in tmux, Terminal.app
f6fb370b1b#9793 keymap: support more (keypad) keycodes
3340e08bec#9423 TUI: Konsole DECSCUSR fixup
:checkhealth
d0fd66ba82 health/provider.vim: check curl HTTPS support
c38862acea#10490 checkhealth: try yarn if npm is missing
43356a43d0#9929 health: check if tmux enabled true colors
ec5a4d862d#9548 checkhealth: validate locale
providers (clipboard, python, etc.):
96be8a2c4d#10161 Allow reloading providers (useful for UIs/clients)
db3c797c6b#9487 provider: improve error message if provider is missing
Various:
36762a00a8#9295 signs: support multiple columns
801fe799ff#10382 eval: wait() (wait for any condition)
9df3a676e7#10400 MsgArea highlight; message grid
a9bea8c104#10790 keymap: allow modifiers to multibyte chars, like <m-ä>
25e0a449bb#10878#4448 paste: redesign (10x+ faster pasting; extensible vim.paste Lua hook)
ef5037e7f6#9706 autocmd: introduce "++once" feature
175398f216#9616 add CompleteChanged autocmd
7fcf2f926f#9717 TextYankPost: add v:event["inclusive"]
3a699a790c#8364 termdebug.vim plugin
ca1ce59025#9709 performance: use os_copy to create backups
ed0e96cd28 man.vim: set 'linebreak'
70f6939fd4#9564 events: add "Signal" event
f89d0d8230#9568 inccommand: auto-disable if folding is slow
FIXES:
41bb68b8e8#10584 process_stop: uv: do not close stdin first/explicitly
e50aa2a6c6#10117 normal: Don't exit CTRL-O mode after processing K_EVENT
95fa71c6d2#9504 :recover : Fix crash on non-existent *.swp
5a836d4767#9507 screen: don't unconditionally clear messages on window scroll
149dcbf2c7#10021 channel: refactor events, prevent recursive invocation of events
d19ff73b39#10107 Fix multiple c_CTRL-D showing statusline
b65a7b7f66#10103 Fix wildmode=list,full and display+=msgsep interaction
0be6d3c86f#9634 fsync: Ignore ENOTSUP. Fix writing to SMB.
b247c6fd22#10025 kbtree: pointer UB and unitialized value fixes
018e0d5a19#9643 API/buffer-updates: always detach on buf-reload
400ee59247#9961 API: fix cursor position when lines are added
769f44e918#9911 win/defaults: Use "…/nvim-data/site" in 'runtimepath'
83d571653b#9911 spellfile.vim: store files in stdpath('data')
8dbf23181a#9887 RPC: conform message-id type to msgpack-RPC spec
5f996e36d1#9894 options: properly reset directories on 'autochdir'
4c4a570156#9807 various CursorMoved fixes
943bedfc86#9853 event-loop: do not set CA_COMMAND_BUSY
9d207fd876#9693 dictwatcheradd(): support b:changedtick
2d50bf3498#9789 mac: fix locale detection
c5631338b1#9754 :mksession : restore tab-local working directories
092e7e6c60#9703#9703 executable(): return false if user is not owner
11a481f711#9686 env var fixes/improvements
8e54847fdf#9666#7920 os/env: Fix completion of multibyte env var names
519382646b#10468 Fix is_executable_in_path() on Windows
8eaa452073#9516 win: exepath(), executable() fixes
f55c1e4233#10544 reltimefloat(): allow negative result
b08dc3ec19#10561 win: jobstart(), system(): $PATHEXT-resolve exe
7cc2b723d4#10392 TextYankPost: spurious/too-early dispatch during delete
6e01ed6a4c OpenBSD: stop jobs/processes properly
58dd5fcc01#10522 jobstop(): close channel before process_stop()
83632022f8#10959 improved resize behavior (all UIs)
c6eb1f42be#10830 API: fix nvim_command_output buffer overflow
cbfd18c85a#10763 startup: handle 'guicursor' after user config
b8f2436feb#10915 jobwait(): fix race if job exits quickly
2fafed6bb8#10765 clipboard: handle/avoid SIGTERM with previous owner
8aca932aa0#9954 clipboard: setreg("*") with clipboard=unnamed
3f10c5b533#9480 performance: clipboard/macOS: assume that pbcopy works
48efafc81c#10398 screen: disable redrawing inside VimResized
5e4b93a38f#10389 API/Lua: make nvim_execute_lua use native lua floats, not special tables
8c6f5b7f92#9934 Spurious quote mark in command line when typing <C-R>
a8a38f3465 Lua 5.2/5.3 compat
:terminal
47b7b471fa#10700 :terminal : update buffer when switching tabpage
5225c1ec30#9605 terminal: Fix potential invalid local 'scrollback'
894f6bee54#8325 :terminal : set topline based on window height
8171e96b96#9551 Improve :terminal resize
d928b036dc#9856 :stopinsert should leave terminal-mode
3f71218505#9926 :terminal : fix: Using `:stopinsert` while in normal mode
5020daa6e5#9883 ui/terminal: make terminal state redraw like any other state
TUI:
9f19e8d29d#9443 TUI: Do not disable BCE for builtin terminfos
a4076e5dcf#9474 win/TUI: fix text overrides line numbers
533d4a36ec#9645 TUI: do not resize host-terminal on startup
b51e5d8b8d#9688 tui_tk_ti_getstr: handle weird value
1f5eac1115#10785 TUI: fix data-race during resize
CHANGES:
9697c7f56a#8194 fix menu_get()
7f2e43c637#9520 improve Lua error messages
c2343180d7#9526 Remove jemalloc
baf93d9606#9581 UI: always use concrete colors for default_colors_set
91688b4883#9563 defaults: set 'scrollback' to -1 by default
bb24fec333#10136 defaults: exclude "S" from 'shortmess'
ddd0eb6f51#8540 startup: -es/-Es (silent/batch mode): skip swapfile
35362495c9#9805 jumplist: avoid extra tail entry
939d9053bd#10573 channels: reflect exit due to signals in exit status code
45c34bd84a#10689 :doautocmd : Never show "No matching autocommands"
fb19aeeb33#9110 API: make nvim_win_set_option() set window-global, not buffer-local
abfc8b3257#10778 emsg_multiline: log Vim errors
06d9cc734b#10657 exists("$FOO"): return false for empty env var
6616d1d3e5#10743 win/env: Vim-compat: Empty string deletes env var
7d664837e1#10662 win: expand nested env var in $HOME
2816bc8620#8349 edit.c: Disable indent during completion
58f505dc74#9829 startup: remove TUI init special-case
Historically Vim/Nvim does backflips to handle input and show messages
before a UI is available. This logical contradiction was already fixed
for remote UIs (#9024c236e80cf3). Fixing it also for the TUI avoids
problems on Windows, simplifies the logic, and avoids races like #9959.
Problem:
During a refactor long ago, we changed the `getdigits_*` familiy of
functions to abort on overflow. But this is often wrong, because many
of these codepaths are handling user input.
Solution:
Decide at each call-site whether to use "strict" mode.
fix#5555
Before this, --embed UIs (without --headless) would not trigger UIEnter.
For TUI, maybe UIEnter isn't useful, but:
- It is less "surprising"/special.
- Makes documentation simpler.
- When TUI becomes a coprocess, it will happen anyway.
simplify handling of default colors
nvim is always true color internally, remove ui_rgb_attached() check.
Fix "runtime termguicolors" test. The test actually reflected broken behavior
in (parent) nvim: nvim_ui_set_option("rgb", true) was not respected by existing
:terminal instances, so all 16-palette colors became dark blue.
Vim added more flags for testing yet more dimensions of its Python
situation. Handle those in eval_has_provider().
vim-patch:8.0.1436: not enough information about what Python version may work
Problem: Not enough information about what Python version may work.
Solution: Add "python_compiled", "python3_compiled", "python_dynamic" and
"python3_dynamic" values for has().
ref: https://github.com/neovim/neovim/pull/10942#issuecomment-529479500
Forcing insert-mode after the first paste-chunk seems to work, as an
alternative to a9e2bae0eb (insert-before-cursor).
NB: Dot-repeat needs to match the original action. Since a9e2bae0eb
changed paste to insert-before-cursor, dot-repeat must also. But that
makes dot-repeat unpleasant/unusual.
Problem: When starting with multiple tabs file messages is confusing.
Solution: Set 'shortmess' when loading the other tabs. (Christian Brabandt)
c75e812623
Inserting "after" the cursor in Normal-mode, for big paste-streams, is
not reliable: sometimes the text "after" the cursor ends up in the
middle of the pasted text. Maybe the cursor position is not updated?
To avoid weird behavior, always paste "before". Maybe nvim_put() or
vim.paste() can be fixed more properly later.
Problem: If multiple paste "chunks" are streamed, chunks after the
first line are pasted into the buffer.
Solution: Check for cmdline-mode for all chunks in a paste-stream.
- Workaround #10966: 'paste' option is not always reset.
- In any case there's not much reason to wait until phase=3, because
pasting in cmdline-mode skips lines after the first line (thus the
`:set paste .. :set nopaste` dance happens only ~once).
* longer timeout with first expect
* Wait for :term to be ready
Failure seen on quickbuild (note the "retry() attempts: 1"):
09:41:07,627 INFO - # test/functional/terminal/tui_spec.lua @ 437: TUI FocusGained/FocusLost in terminal-mode
09:41:07,627 INFO - not ok 2976 - TUI FocusGained/FocusLost in terminal-mode
09:41:07,627 INFO - # test/functional/terminal/tui_spec.lua @ 437
09:41:07,627 INFO - # Failure message: ./test/functional/helpers.lua:403:
09:41:07,627 INFO - # retry() attempts: 1
09:41:07,627 INFO - # ./test/functional/ui/screen.lua:579: Row 1 did not match.
09:41:07,627 INFO - # Expected:
09:41:07,627 INFO - # |*{1:r}eady $ |
09:41:07,627 INFO - # |[Process exited 0] |
09:41:07,627 INFO - # | |
09:41:07,627 INFO - # | |
09:41:07,627 INFO - # | |
09:41:07,627 INFO - # |gained |
09:41:07,628 INFO - # |{3:-- TERMINAL --} |
09:41:07,628 INFO - # Actual:
09:41:07,628 INFO - # |*{1: } |
09:41:07,628 INFO - # |{4:~ }|
09:41:07,628 INFO - # |{4:~ }|
09:41:07,628 INFO - # |{4:~ }|
09:41:07,628 INFO - # |{5:[No Name] }|
09:41:07,628 INFO - # | |
09:41:07,628 INFO - # |{3:-- TERMINAL --} |
09:41:07,628 INFO - #
09:41:07,628 INFO - # To print the expect() call that would assert the current screen state, use
09:41:07,628 INFO - # screen:snapshot_util(). In case of non-deterministic failures, use
09:41:07,628 INFO - # screen:redraw_debug() to show all intermediate screen states.
09:41:07,628 INFO - # stack traceback:
09:41:07,628 INFO - # ./test/functional/helpers.lua:403: in function 'retry'
09:41:07,628 INFO - # test/functional/terminal/tui_spec.lua:441: in function <test/functional/terminal/tui_spec.lua:437>
Since 8b8ecf4, the shada module loads files in the jumplist to properly
clear duplicates. This can trigger some autocommands, which in turn
saves and restores search and substitute patterns, freeing the previous
strings in "spats" which are held in "wms" as well (heap-use-after-free).
To avoid this, initialize the jumplist in "wms" before search patterns.
- Rename `meth_pcall`.
- Make `pcall_err` raise an error if the function does not fail.
- Add `vim.pesc()` to treat a string as literal where a Lua pattern is
expected.
* test/wildmode_spec: fix flaky test
a00eb23c27 fixed one race, but not this one:
[ ERROR ] test/functional/ui/wildmode_spec.lua @ 84: 'wildmenu' is preserved during :terminal activity
test/functional/ui/screen.lua:587: Row 1 did not match.
Expected:
|* |
| |
| |
|define jump list > |
|:sign define^ |
Actual:
|*0: !terminal_output! |
| |
| |
|define jump list > |
|:sign define^ |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/ui/screen.lua:587: in function '_wait'
test/functional/ui/screen.lua:370: in function 'expect'
test/functional/ui/wildmode_spec.lua:22: in function 'expect_stay_unchanged'
test/functional/ui/wildmode_spec.lua:92: in function <test/functional/ui/wildmode_spec.lua:84>
* fixup! test/wildmode_spec: fix flaky test
Doing clear() multiple times in quick succession provokes the
`exit_event` race described in #8813.
- Avoid it by removing unnecessary reset() call.
- Replace unnecessary nested describe() blocks with it() blocks.
ref d4a0b6c4e1
a00eb23c27 fixed one race, but not this one:
[ ERROR ] test/functional/ui/wildmode_spec.lua @ 84: 'wildmenu' is preserved during :terminal activity
test/functional/ui/screen.lua:587: Row 1 did not match.
Expected:
|* |
| |
| |
|define jump list > |
|:sign define^ |
Actual:
|*0: !terminal_output! |
| |
| |
|define jump list > |
|:sign define^ |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/ui/screen.lua:587: in function '_wait'
test/functional/ui/screen.lua:370: in function 'expect'
test/functional/ui/wildmode_spec.lua:22: in function 'expect_stay_unchanged'
test/functional/ui/wildmode_spec.lua:92: in function <test/functional/ui/wildmode_spec.lua:84>
- Always load files when cleaning up jumplist.
- For Shada: avoids writing duplicate entries, which happens when you read
from a shada file with duplicate entries (merging the jumplist while
writing sometimes produces duplicate entries, bug?) and then write right
away (i.e.: without any `:jumps`, `getjumplist()`, or any jump movement,
that is: nothing that calls `cleanup_jumplist` with `loadfiles == true`).
- For Context: avoids non-idempotent behavior for the same reason (i.e.:
first call to `shada_encode_jumps` does not remove duplicate entries).
- Do not set pcmark when dumping jumplist for Context.
- Retrieving current Context shouldn't add an entry to the jumplist
(which will be removed by a subsequent `cleanup_jumplist` anyway, i.e.:
tail entry matching current position), just act like `getjumplist` for
instance.
Problem: If a job exits while waiting on another job, the on_exit
handler is queued but f_jobwait() skips it.
Solution: Always do process_wait(), so that handlers are run during
f_jobwait().
fix#8302
Test case:
$ BUSTED_ARGS="--repeat=2000 --no-keep-going" TEST_FILE=test/functional/core/job_spec.lua TEST_FILTER=waiting make functionaltest
Failure example (macOS CI):
FAILED test/functional/core/job_spec.lua: jobs jobwait will run callbacks while waiting
test/functional/core/job_spec.lua:606: Expected objects to be the same.
Passed in:
(table: 0x1be77c80) {
[1] = 'notification'
[2] = 'wait'
*[3] = {
*[1] = 3 } }
Expected:
(table: 0x1be77d10) {
[1] = 'notification'
[2] = 'wait'
*[3] = {
*[1] = 4 } }
stack traceback:
test/functional/core/job_spec.lua:606: in function <test/functional/core/job_spec.lua:583
[ ERROR ] test/functional\ui\wildmode_spec.lua @ 84: 'wildmenu' is preserved during :terminal activity
test\functional\ui\screen.lua:587: Row 1 did not match.
Expected:
|*:sign |
|*define place |
|*jump undefine |
|*list unplace |
|*:sign ^ |
Actual:
|*0: !terminal |
|* |
|*^ |
|*~ |
|* |
stack traceback:
test\functional\ui\screen.lua:587: in function '_wait'
test\functional\ui\screen.lua:370: in function 'expect'
test/functional\ui\wildmode_spec.lua:22: in function 'expect_stay_unchanged'
test/functional\ui\wildmode_spec.lua:103: in function <test/functional\ui\wildmode_spec.lua:84>
Test sometimes fails on macOS CI:
FAILED test/functional/core/job_spec.lua: jobs jobwait will run callbacks while waiting
test/functional/core/job_spec.lua:606: Expected objects to be the same.
Passed in:
(table: 0x1be77c80) {
[1] = 'notification'
[2] = 'wait'
*[3] = {
*[1] = 3 } }
Expected:
(table: 0x1be77d10) {
[1] = 'notification'
[2] = 'wait'
*[3] = {
*[1] = 4 } }
stack traceback:
test/functional/core/job_spec.lua:606: in function <test/functional/core/job_spec.lua:583
Change the test to check if all jobs are starting, not only exiting.
luassert uses 3 by default, which is often not enough.
Instead of documenting how to increase it, let's use a more fitting
(sane) default of 100 levels.
Currently `nvim -u NORC --cmd "set display-=msgsep"` will still allocate the
message grid and remove it just afterwards. While inefficient, we must
make sure update_screen() re-validates the default_grid completely when
this happens.
Fix some invalid logic: don't reallocate msg_grid on resize when the grid is not
used.
Elide a too early ui_flush() on startup, which caused an invalid cursor
position to be used.