Problem: completion: Functions specified in the 'complete' option did
not have the leader string removed when called with findstart = 0,
unlike 'omnifunc' behavior
Solution: update behaviour and make behaviour consistent (Girish Palya)
closes: vim/vim#17636fa16c7ab3f
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Currently terminal highlight attribute buffers are statically allocated
be the size of `TERM_ATTRS_MAX`. This unique case isn't respected in
some places in the ui_compositor. Due to this, when a terminal window
has lines longer them `TERM_ATTRS_MAX`, the compositor will go past the
end of the buffer causing a crash due to out of bounds access.
Solution: Add check to ensure we don't query terminal highlight attrs
past `TERM_ATTRS_MAX` in `win_line()`.
Fixes#30374
fix(exrc): lua exrc files know their location
Problem:
'exrc' files are inherently bound to their location / workspace and
therefore require to "know" their location on the filesystem. However,
currently using `debug.getinfo(1, 'S')` returns `"<nvim>"`.
Solution:
Include the filepath as chunkname in `loadstring()` and `nlua_exec()`.
Problem: Currently `vim.api.nvim__screenshot()` crashes when called with an
invalid path. This is because we don't check if `fopen()` returns a null
pointer.
Solution: Bail out if `fopen()` returns a null pointer.
Fixes: https://github.com/neovim/neovim/issues/34593
Problem: When a floating window with high winblend uses a highlight group
with underline (but without guisp), the underline appears red.
Solution: Only blend the special color (for underline/undercurl) if the
foreground highlight actually has underline or undercurl set.
Otherwise, ignore the special color.
Problem: Topline is preemptively updated by line() in WinResized
autocmd with 'splitkeep' != "cursor".
Solution: Set `skip_update_topline` when 'splitkeep' != "cursor".
(Luuk van Baal)
fe803c8c04
Problem: ext_messages cannot tell when the screen was cleared, which is
needed to clear visible messages. An empty message is also
never emitted, but clears messages from the message grid.
Solution: Repurpose the "msg_clear" event to be emitted when the screen
was cleared. Emit an empty message with the `empty` kind to
hint to a UI to clear the cmdline area.
- Render Lua types in api.txt.
- Added `DictAs(name)` API type which acts the same as `Dict` (no parens)
when generating the dispatchers, but acts the same as `Dict(name)`
when generating docs.
- Added `Tuple(...)` API type which is the treated the as `Array` for
generating the dispatchers, but is used to document richer types.
- Added `Enum(...)` API type to better document enums
- Improve typing of some API functions.
- Improve c_grammar to properly parse API types and replace string pattern
logic in the parsers.
- Removed all the hardcoded type overrides in gen_eval_files.lua
Problem: ext_messages is implemented to mimic the message grid
implementation w.r.t. scrolling messages, clearing scrolled
messages, hit-enter-prompts and replacing a previous message.
Meanwhile, an ext_messages UI may not be implemented in a way
where these events are wanted. Moreover, correctness of these
events even assuming a "scrolled message" implementation
depends on fragile "currently visible messages" global state,
which already isn't correct after a previous message was
supposed to have been overwritten (because that should not only
happen when `msg_scroll == false`).
Solution: - No longer attempt to keep track of the currently visible
messages: remove the `msg_ext(_history)_visible` variables.
UIs may remove messages pre-emptively (timer based), or never
show messages that don't fit a certain area in the first place.
- No longer emit the `msg(_history)_clear` events to clear
"scrolled" messages. This opens up the `msg_clear` event to
be emitted when messages should actually be cleared (e.g.
when the screen is cleared). May also be useful to emit before
the first message in an event loop cycle as a hint to the UI
that it is a new batch of messages (vim._extui currently
schedules an event to determine that).
- Set `replace_last` explicitly at the few callsites that want
this to be set to true to replace an incomplete status message.
- Don't store a "keep" message to be re-emitted.
Problem:
Not easy to get user-input in prompt-buffer before the user submits the
input. Under the current system user/plugin needs to read the buffer
contents, figure out where the prompt is, then extract the text.
Solution:
- Add prompt_getinput().
- Extract prompt text extraction logic to a separate function
Problem: "cmdline_show" event may be emitted with an invalid cursor
position, causing a redraw that will clear the match highlight.
Solution: Mark the cursor position as valid so that a "cmdline_show"
callback that updates the screen does not clear the match highlight.
Problem:
With `formatoptions+=r`, the prompt prefix "%" is treated as
comment-start (because of global default 'comments' option contains
"%"), so it gets added to the start of the line when a new line
is input in a prompt.
Solution:
Unset the 'comments' option in prompt buffers by default.
Problem: OptionSet autocmd emitted with invalid grids after entering
tabpage with different 'cmdheight'.
Solution: First call `tabpage_check_windows()` before changing 'cmdheight'.
Add a test that exercises the `vim._extui` cmdline.
Problem: missing out-of-memory checks in cmdexpand.c
Solution: add missing out-of-memory checks, re-order code
(John Marriott)
This commit does the following:
- in cmdline_pum_create() add out-of-memory check call of ALLOC_MULT()
- in expand_cmdline() move check for out-of-memory to cover both
assignments of file_str
- in nextwild() don't free `p2` until after it's last use.
closes: vim/vim#175921be5b375c4
N/A patch:
vim-patch:9.1.1474: missing out-of-memory check in mark.c
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: ml_get error when updating quickfix buffer with nvim_buf_attach
Solution: use correct lnume parameter in changed_lines for append mode
Fix#34610
Problem: On Windows, the value of `term` is overwritten without freeing
the old allocated value, which may lead to a memory leak.
GCC also gives a "incompatible pointer type" warning about
passing `*term` to os_tty_guess_term().
Solution: Don't override the old allocated value, and copy the guessed
value to `term` if its old value is NULL.
Problem: inconsistent range arg for :diffget/diffput
Solution: fix the range specification, place the cursor for :diffput and
:diffget consistently on the last line (Yee Cheng Chin)
Previously, `:<range>diffget` only allowed using 1 or above in the range
value, making it impossible to use the command for a diff block at the
beginning of the file. Fix the range specification so the user can now
use 0 to specify the space before the first line. This allows
`:0,$+1diffget` to work to retrieve all the changes from the other file
instead of missing the first diff block. Also do this for `:diffput`.
Also, make `:diffput` work more similar to `:diffget`. Make it so that
if the cursor is on the last line and a new line is inserted in the
other file, doing `:diffput` will select that diff block below the line,
just like `:diffget` would.
Also clean up the logic a little bit for edge cases and for handling
line matched diff blocks better.
closes: vim/vim#17579d75ab0cbf5
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: Currently our CI is failing due to msvc warning 5287. This
warning tells us that we are performing a binary expression with enums
of two different types. In this case however, this is clearly intended
and valid.
Solution: Suppress warning 5287 on the line this occurs.
Problem: too many strlen() calls
Solution: Change expand_env() to return string length
(John Marriott)
This commit does the following changes:
- In expand_env_esc():
- return the length of the returned dst string.
- refactor to remove some calls to STRLEN() and STRCAT()
- add check for out-of-memory condition.
- Change call sites in various source files to use the return value
closes: vim/vim#17561fff0132399
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: No ext_messages kind for the :command, :version commands.
:version is emitted as multiple events.
Solution: Assign them the "list_cmd" kind. Use `msg_put*` to properly
format the message as a single event.
Problem:
Cannot enter multiline prompts in a buftype=prompt buffer.
Solution:
- Support shift+enter (`<s-enter>`) to start a new line in the prompt.
- Pasting multiline text via OS paste, clipboard, "xp, etc.
- A/I in editable region works as usual.
- i/a/A/I outside of editable region moves cursor to end of current
prompt.
- Support undo/redo in prompt buffer.
- Support o/O in prompt buffer.
- Expose prompt location as `':` mark.
Problem: Buffer events (specifically on_bytes callbacks) weren't triggered when the
quickfix list was modified, preventing buffer change notifications.
Solution: Add code to send both bytes and lines change notifications after
quickfix buffer updates to properly trigger all attached callbacks.
Workaround (not a fix) for #27196 and for #33067
Asserts are meant to apply to debug builds but not release
builds for users. However the intermediate RelWithDebInfo
build type is quite often used by end users, so we might
want to disable certain problematic asserts there, while
still preserving them in Debug mode for CI.
Problem: Screen may be updated by a msg_showcmd event before '"' is
cleared from the screen with register insertion.
Solution: Emit the msg_showcmd event before clearing the '"'.
Problem: The "append" parameter added in abb40ece is missing from
history entries, resulting in different message formatting
for "g<".
Solution: Add "append" field to message history entries.
Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
Problem: Cmdline buffer is not cleared for a new message (since c973c7ae),
resulting in an incorrect spill indicator. When the cmdline
buffer is cleared, "msg_row" is not invalidated, resulting in
an error. The extui module is untested.
Return value of `vim.ui_attach()->callback` is undocumented.
Solution: Clear the cmdline buffer for the first message in an event
loop iteration. Ensure msg_row passed as end_row does not
exceed buffer length.
Add `messages_spec2.lua` to test the extui module, keeping in
mind that test coverage will greatly increase if this UI is made
the default. As such, only tests for specific extui functionality
unlikely to be covered by tests leveraging the current message grid.
Document the return value of `vim.ui_attach()->callback`, it seems
to make sense, and is also used to suppress remote UI events in
`messages_spec2.lua`.
Problem: When closing a floating window, the next window to be entered
may be unfocusable or hidden.
Solution: Don't enter prevwin when it is unfocusable or hidden. Enter
firstwin instead (like for when prevwin is no longer valid).
Problem: nvim_parse_cmd() incorrectly splits mapping commands like
into three arguments instead of preserving whitespace in the RHS.
Solution: Add special handling for mapping commands to parse them as exactly
two arguments - the LHS and the RHS with all whitespace preserved.