Problem: a long message is cropped to keep the ruler visible. But when
the message is repeated, it can be written over the ruler, while the
repetition indicator "(1)" is still placed just before the ruler, which
ends up somewhere inside the message.
Solution: currently, long messages are only cropped when setting the
'last' virttext. Make sure this happens after a repeated long message.
Problem: when the search count is displayed, the showcmd virt_text is
set to 11 empty spaces to ensure a consistent distance between search
count and ruler, or screen edge in case of noruler. But when the search
count is removed to make place for a message, the empty dummy showcmd
remains and unnecessarily erases part of the message.
Solution: properly remove showcmd together with search count.
- with today's screens, the arbitrary 50 cells limit is no longer as
ample as a few decades ago
- minwid is effectively constrained by the output buffer size anyway, so
accidentally setting huge numbers introduces no noticeable lag
- restores some backwards compatibility to ui2 for the edge-case where
the ruler width was set to a number > 50 with the item group syntax
Problem: before ui2, the ruler in the last line had a one cell safety
margin on the right because writing in the last column of the last line
"scrolls the screen up on some terminals," according to code comments.
When the ruler is included in the statusline, it aligns on the left with
the normal ruler, but goes all the way to the screen edge on the right,
and is therefore one cell longer.
Since ui2 doesn't have that padding cell, they don't align anymore.
Also, in the future, when the C implementation of the ruler will be
replaced with a default expression that will be included in the default
statusline (currently `%-14.(%l,%c%V%) %P`), the width will naturally be
the same in both places, and the unit tests will need adapting anyway.
Solution: when ui2 is active, increase the ruler width by 1.
BREAKING CHANGE: the default ruler in ui2 is now 1 cell wider.
ref https://github.com/neovim/neovim/issues/40247
Problem: ui2's ruler is no longer of fixed width, and the internal width
variable `ru_wid` now acts as an arbitrary maximum, which is unnecessary
because the same can now be achieved transparently with an item group.
Furthermore, the old way of setting `ru_wid` with an overloaded subset
of the item group syntax leads to a number of inconsistencies. In
particular, when the configured ruler expression is reused for including
the ruler into the statusline, where the item group syntax is
interpreted in the usual way. The fact that this width is set in the
`minwid` position is more confusing now that it is a de-facto maximum.
Solution: for ui2, constrain the ruler only by half the screen width,
which previously was an additional limit relevant on small screens.
Skip the special-case treatment of the ruler's leading item group spec,
process it like a normal item group.
Example: the current fallback ruler expression in the default statusline
now actually works for `rulerformat` itself:
set rulerformat=%-14.(%l,%c%V%)\ %P
because the result can naturally expand to 18 cells instead of being
truncated to the default 17 cells, and removing the period after
`minwid` doesn't change the result, whereas before, it would unhelpfully
lead to setting the fixed ruler width to 14 cells.
BREAKING CHANGE: if the user used to set the ruler's fixed width, it
will now be treated as minimum instead of a maximum width, which in
practice increases backwards-compatibility with ui1 and vim. The main
remaining difference is that item groups are right-aligned by default,
but backwards-compatibility can be achieved by setting a negative
`minwid`, which ui1 and vim ignore. To restore the previous fixed width,
specify `maxwid` as well, but this does not work in ui1 and vim.
If `rulerformat` contains a `%=` without enclosing item group, it will
now expand to fill half the screen width. But in that case, it will
already spread out similarly in the new expression-based statusline, so
consistency of the ruler in both positions is increased.
To simulate the previous default behaviour, wrap it in `%-17.17(...%)`.
For best compatibility and reuse with vim, leave out `maxwid` and make
`minwid` negative, e.g. `%-20(...%)`.
fix https://github.com/neovim/neovim/issues/40247
FAILED 2 tests, listed below:
FAILED …/lua/system_spec.lua:124: …/lua/system_spec.lua @ 44: vim.system (async) supports timeout
…/lua/system_spec.lua:124: …/lua/system_spec.lua:44: process still exists
stack traceback:
D:/a/neovim/neovim/test/functional/testnvim/exec_lua.lua:124: in function 'system'
…/lua/system_spec.lua:124: in function <…/lua/system_spec.lua:118>
FAILED …/lua/system_spec.lua:111: …/lua/system_spec.lua @ 22: vim.system (sync) can set environment with clear_env = true and env = nil
…/lua/system_spec.lua:111: …/lua/system_spec.lua:22: process still exists
stack traceback:
D:/a/neovim/neovim/test/functional/testnvim/exec_lua.lua:124: in function 'system'
…/lua/system_spec.lua:111: in function <…/lua/system_spec.lua:97>
Problem:
unreliable test:
FAILED …/tui_spec.lua @ 895: TUI mouse events work with right-click menu (escape sequences sent to child)
D:/a/…/testnvim.lua:144: Vim:Failed to start server: address already in use
stack traceback:
D:/a/…/testnvim.lua:144: in function 'eval'
D:/a/…/testnvim.lua:1015: in function 'new_pipename'
…/tui_spec.lua:897: in function <…/tui_spec.lua:895>
Solution:
Workaround potential PID reuse.
Problem: nvim_cmd() accepts number/boolean in args and converts them
to strings, but the keyset declares ArrayOf(String).
Solution: use ArrayOf(Union(Integer, String, Boolean)) and wrap union
types in parens when generating array annotations.
Problem:
Changing global 'winbar' only updates window layout state in the current
tabpage. This means existing hidden tabs can keep stale winbar height.
Solution:
Recompute winbar state for all tabpages on global `'winbar'` changes.
Problem:
`vim.filetype.match()` needs a cheap way to recognize directory buffers
without doing filesystem stat work.
Solution:
Ensure full buffer names for directories end in a trailing slash. Now
directory buffers can proceed through the normal 'filetype' path.
Note side-effects: session and ShaDa buffer-list restore behavior must
be compatible, so those + corresponding tests must be updated.
unify context-switching logic.
1. `prevwin` is now restored for all targets (was buf-only).
- add a `nvim_win_call` test.
2. The buf-found "restore the shown buffer" dance no longer depends on
the origin window: it runs even if the callback closed the origin.
Problem:
`screen:expect({none=…})` with no any/grid crashed (concat on nil)
because actual_rows was only rendered when any or grid was present.
Solution:
Update the condition.
Problem:
A `--listen` path longer than the system socket path limit (~104 bytes on
macOS, 108 on Linux) is silently truncated by `uv_pipe_bind()`. Nvim either
serves a socket at a different path than `v:servername` reports, or fails with
an error that blames the full untruncated path (confusing):
nvim: Failed to --listen: address already in use: "<full path>"
Steps to reproduce:
$ nvim --listen /var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/-Users-rpatterson-Projects-src-github.com-neovide-neovide --embed -p
nvim: Failed to --listen: address already in use: "/var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/-Users-rpatterson-Projects-src-github.com-neovide-neovide"
$ ls /var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/-Users-rpatterson-Projects-src-github.com-neovide-neovide
"/var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/-Users-rpatterson-Projects-src-github.com-neovide-neovide": No such file or directory (os error 2)
$ ls -l /var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/
srwxr-xr-x@ - rpatterson 31 Mar 10:24 -Users-rpatterson-Projects-src-github.com-neovid
Solution:
Bind with `uv_pipe_bind2()` and `UV_PIPE_NO_TRUNCATE` (libuv 1.46+), so
a too-long path fails up front with the actual reason:
nvim: Failed to --listen: invalid argument: "<full path>"
Problem:
`magic` was owned by `CmdParseInfo`, but command handlers
need it at execution time via `exarg_T`.
Solution:
Move `magic` into `exarg_T`, and initialize it in `parse_cmdline()`.
Problem: No concise way to execute a callback with temporarily set
working directory. This might be useful when sourcing nested files to
allow them to assume that current working directory is their root
directory.
Solution: Add `cwd` context to `vim._with().`
Problem: The default 'packlockfile' value doesn't respect $NVIM_APPNAME.
Solution: Use more direct way of setting the default value, following
the example of other options with a similar behavior.
Problem: when an LS client detaches from the buffer, only pull diagnostics
are cleared via capability framework. Push diagnostics remain stuck even
when client stops/restarts.
Solution: clear push diagnostics on client detach.
ref #33864
When a server supports both document and workspace pull diagnostics,
`on_refresh` only dispatched a `workspace/diagnostic` request. The
workspace response handler skips buffers with `pull_kind == "document"`
(i.e. all buffers opened by the user), so their diagnostics went stale
until the next `didChange` or `didOpen` event.
Change `on_refresh` to always refresh document-pull buffers via
`textDocument/diagnostic`, regardless of whether the server also
supports workspace diagnostics. This ensures that opened buffers
see updated diagnostics (e.g. after a save triggers an external
tool like PHPStan) without requiring the user to re-enter insert
mode.
Problem:
`vim.fs` does not provide a directory creation helper matching its
filesystem API shape.
Solution:
Add `vim.fs.mkdir()` as a thin wrapper around `vim.fn.mkdir()`, with
`parents` and `mode` options.
Problem: The codelens LSP module was using its own raw buffer events and
its own debounce mechanism for refreshing code lens in attached buffers.
Solution: Switch the module to using the LspNotify autocmd events.
LspNotify fires just after document versions are synced with the server
and provides a built in debounce mechanism for changes.
Additionally, this fixes some bugs with the previous implementation:
1. The workspace/codeLens/refresh handler re-requested codelens for all
buffers but when the response came back, it forced an extra redraw
after clearing the work the handler had just done.
2. Document synchronization was reworked to be more resilient to
multiple clients providing codelens for a single buffer. The latest
document version is now separately tracked per client (and per
client's lenses per row) instead of for the buffer as a whole. This
allows the on_win() function to properly redraw all codelens even
when different clients' responses for a particular document version
come back at different times.