This just cleans up some old definitions from before tui_set_term_mode
existed. There is no need to represent custom modes in a different
format just because they are safe without feature detection.
According to terminfo(5), these are obsolete:
Except for very old terminal descriptions, e.g., those developed
for SVr4, the scheme just described should be considered obsolete.
An improved set of capabilities was added late in the SVr4
releases (smglr and smgtb), which explicitly use two parameters
for setting the left/right or top/bottom margins.
Current "patch" asserts that EVERY terminal claiming to be an xterm has
broken vertical split scrolling which is far too an aggressive
workaround.
Instead, as left-right margins for scrolling regions use a
private DEC mode, we can use feature detection to use them in supported
terminals only. This way, users who use properly implemented terminals
can enjoy hardware accelerated scrolling even with vertical split
windows.
A primary device callback may set a new callback (e.g. when suspending),
so clearing it after invoking it is too late.
While at it, add missing reset of did_set_grapheme_cluster_mode in
terminfo_start().
Problem: One-off error in "count" to make "w_skipcol" zero with
'nosmoothscroll' page scrolling when last virtual line
in a buffer line is exactly the entire window width.
(Hirohito Higashi)
Solution: Properly compute the smallest integer value necessary
to make "w_skipcol" zero (Luuk van Baal)
c6c72d165c
Problem: buflist_new() leaks ffname and fails to reuse curbuf when
autocommands from buf_freeall change curbuf. Plus, a new
buffer is not allocated in this case, despite what the comment
above claims.
Solution: Remove the condition so ffname is not leaked and so a new
buffer is allocated like before v8.2.4791. It should not be
possible for undo_ftplugin or buf_freeall autocommands to
delete the buffer as they set b_locked, but to stay consistent
with other uses of buf_freeall, guard against that anyway
(Sean Dewar).
Note that buf is set to NULL if it was deleted to guard against the (rare)
possibility of messing up the "buf != curbuf" condition below if a new buffer
happens to be allocated at the same address.
closes: vim/vim#173190077282c82
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Cannot get completion startcol when space is not the first
trigger character (after v9.1.1383)
Solution: Detect the next comma followed by a space in the option string
and use in next compare loop (glepnir)
closes: vim/vim#1731108db2f4f28
This is a left-over for when we ported to state-less scrolling events
(e.g. no scrolling regions as part of the ext_linegrid state).
We always reset the scrolling region after performing a non-fullscreen
scroll. Thus the extra check in tui_grid_resize() is not needed.
Problem: Loop that ensures "w_skipcol" is zero with 'nosmoothscroll'
for (half)-page scrolling is inefficient.
Solution: Calculate the required "count" instead of looping until
"w_skipcol" is zero (Luuk van Baal).
acf0ebe8a8
Problem: When a space character is used as a trigger in 'isexpand' option
it doesn't get recognized because skip_to_option_part() skips
spaces after a comma, treating them as option separators
rather than option value (after v9.1.1341)
Solution: manually set the part to a space character (glepnir).
closes: vim/vim#173058d0e42b710
Problem: When an autocommand executes for a non-current buffer,
'eventignorewin' is only checked from the buffer's last
wininfo (overwrites win_ignore in the loop), not from the
value of 'eventignorewin' in all windows showing the buffer as
described (after v9.1.1084)
Solution: Fix the check and don't use wininfo, as that may only contain
windows that recently showed the buffer. Consider all the
buffer's windows in all tabpages (Sean Dewar).
closes: vim/vim#17294d4110e0695
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
feat(exrc): search exrc in parent directories
Problem:
`.nvim.lua` is only loaded from current directory, which is not flexible
when working from a subfolder of the project.
Solution:
Also search parent directories for configuration file.
Problem: when failing to wipeout a quickfix dummy buffer, it will
remain as a dummy buffer, despite being kept.
Solution: clear its dummy BF_DUMMY flag in this case (Sean Dewar).
closes: vim/vim#17283270124f46a
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: heap use-after-free possible when autocommands switch away from the
quickfix dummy buffer, but leave it open in a window.
Solution: close its windows first before attempting the wipe.
(Sean Dewar)
related: vim/vim#17283b4074ead5c
Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Problem: Cannot return to the original text after selecting the next
item when the currently selected item is the last one.
Solution: When continuing to move down past the last item, locate the
original completion at the head/tail nodes of the completed
linked list (glepnir).
closes: vim/vim#173005a18ccf490
Problem: If the only highlight present in the buffer is an extmark, and its end
position is outside the screen, redraws that start on lines after the
first line of the mark will consider the buffer as not having any highlights,
and skip drawing the mark's highlight.
Solution: Check the updated number of decor ranges.
Problem: Extui does not route messages emitted as a result of a typed
command to the "more" window.
Command message leading shell messages is missing a kind.
Messages not routed to 'cmdheight' area after it was 0.
Solution: Route messages that were emitted in the same event loop as an
entered command to the "more" window. Also append multiple
messages in an already open more-window.
Assign it the `shell_cmd` kind.
Change message position when 'cmdheight' changes from 0.
Problem: Currently, 'smartcase' is respected when completing keywords
using <C-N>, <C-P>, <C-X><C-N>, and <C-X><C-P>. However, when
a user continues typing and the completion menu is filtered
using cached matches, 'smartcase' is not applied. This leads
to poor-quality or irrelevant completion suggestions, as shown
in the example below.
Solution: When filtering cached completion items after typing additional
characters, apply case-sensitive comparison if 'smartcase' is
enabled and the typed pattern includes uppercase characters.
This ensures consistent and expected completion behavior.
(Girish Palya)
closes: vim/vim#17271dc314053e1
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: Flag checking logic uses a temporary variable and multiple
bitwise operations in insexpand.c
Solution: Consolidate into a single equality check using bitwise OR and
comparison (glepnir)
closes: vim/vim#17276c3fbaa086e
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Messages that are already added to the history are not emitted
as part of the "g<" msg_history_show event.
Solution: Move clearing the history for temporary messages to before
adding a message to the history, rather than after emitting
a message.
Problem:
decorations_spec.lua, float_spec.lua, multigrid_spec.lua are not
auto-formatted.
Solution:
Add a special `formatlua2` cmake target, which invokes `stylua` with
an alternative `.stylua2.toml` config.
Problem:
termkey crashes due to an out-of-bounds write in an array when it
received a CSI sequence with 17 or more arguments. This could be
observed on startup with certain terminal emulators like [RLogin], which
send a response to the `CSI c` query containing 17 parameters.
The termkey code has a boundary check, but its comparison operator is
incorrect.
Solution:
Correct the comparison operator to ensure proper boundary checking.
With this change, I have confirmed that the crash no longer occurs on
RLogin. https://github.com/kmiya-culti/RLoginFixes#24356
Problem: Missing kind and separate event for each line for message
containing buffer lines for e.g. `:print`.
Solution: Set the `list_cmd` kind and only `msg_start()` for the first
message, print a newline instead.
Problem:
When searching for the next pattern via n/N/*/#, cursor
moves to cmdline, perceived as "flicker".
Solution:
Can ui_busy_start() and ui_busy_stop().
${CONFIG} is an empty string even when configuration is known at
configuration time. $<CONFIG> has to be used at "generation time"
Currently zig's reimplementation of cmake config headers does not
support $<CONFIG> so use a branch to pick the one which works.
Problem: [security]: Possible to open more windows into a closing
buffer without splitting, bypassing existing "b_locked_split"
checks and triggering use-after-free
Solution: Disallow switching to a closing buffer. Editing a closing
buffer (via ":edit", etc.) was fixed in v9.1.0764, but add an
error message and check just "b_locked_split", as "b_locked"
is necessary only when the buffer shouldn't be wiped, and may
be set for buffers that are in-use but not actually closing.
(Sean Dewar)
closes: vim/vim#172466cb1c82840
Problem: Ruler is not cleared from the screen/ext_messages state when
it is no longer drawn after e.g. `set noruler` or when moving
from a floating to a regular window.
Solution: Remember if ruler was drawn and clear it.
Problem: `:copen` opens at the bottom by switching to `lastwin`,
needlessly changing the window it inherits context from.
Solution: Use the `WSP_BOT` flag to `win_split()` to open at the bottom.
Problem:
`input->in_fd = STDIN_FILENO;` was set twice during TUI initialization.
Solution:
Remove the duplicate assignment for clarity and better performance
Problem:
`any[]` means nothing, and the return value is not the same as what's
documented in the comment (eg, Lua returns `{ "row", { { "leaf", 1000 },
{ "leaf", 1001 } } }`, not `{ "row", { "leaf", 1000, "leaf", 1001 } }`)
Solution:
Create two classes (vim.fn.winlayout.leaf and vim.fn.winlayout.branch)
and one alias that links the two together.
Also: Due to LuaLS limitations, there is an empty class,
vim.fn.winlayout.empty
Signed-Off-By: VoxelPrismatic <voxelprismatic@pm.me>
Problem: Using `<C-W>w`, `<C-W>W` or the ":wincmd" variants with a count can
enter unfocusable or hidden floating windows. This is especially problematic
when using the new in-development extui, which creates many unfocusable floats
for various UI elements.
Solution: Skip unfocusable and hidden floating windows. Instead, skip to the
next focusable, non-hidden window in the current tabpage's window list. Reword
the documentation a bit (hopefully an improvement?)
Problem: The TUI doesn't forward a key properly when it has unsupported
modifiers like NumLock.
Solution: Don't try to add modifiers when only unsupported modifiers are
present.
Related #33791
Problem:
stderr messages from executing ":!cmd" show up with
highlight hl-ErrorMsg. But some shell utilites use stderr for debug
logging, progress updates, etc.
Solution:
Highlight shell command outputs hl-StderrMsg and hl-StdoutMsg.
This fixes the problem that sending a raw C0 control code to trigger a
mapping for it does not work in Terminal mode.
Note: this isn't done for 00 or 7F, as that'll be backward-incompatible.
Problem: We have an unmaintained Vimscript parser and cmdline
highlighting mechanism, with which it is hard to leverage the
treesitter highlighter. Long messages result in a hit-enter-prompt.
Solution: Implement a vim.ui_attach() UI, that replaces the message
grid (orphaning some 3000+ LOC core C code). Introduce an experimental
vim._extui module, because removing the message grid at the same time is
too risky. The new UI leverages the bundled treesitter highlighter and
parser for Vimscript, as well as the matchparen plugin, to highlight the
cmdline. Messages are truncated in the cmdline area, or placed in a
floating message box in the bottom right corner. Special ("list_cmd")
messages and the message history are shown in a, "more prompt" (now a
fully interactive regular window). Various default UI elements ('showcmd',
'ruler') are also placed in the cmdline area, as virtual text.
`require('vim._extui').enable({})` enables the experimental UI.
`{ msg.pos = 'box' }` or `:set cmdheight=0` enables the message
box variant.
Followup:
- Come to a consensus for how best to represent messages (by default).
- Start removing message grid when this is deemed a successful replacement.
When that is finished, make this new UI the default and update a lot of tests.