Problem: winhighlight option handling can be improved
(after: v9.2.0093)
Solution: Check entire override stack in update_highlight_overrides();
update w_hl of every window in highlight_changed() (Foxe Chen).
closes: #19633
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Using a composing character as the end of a range inside a
collection may corrupt the NFA postfix stack
(Nathan Mills, after v9.1.0011)
Solution: When a character is used as the endpoint of a range, do not emit
its composing characters separately. Range handling only uses
the base codepoint.
supported by AI
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-9phh-423r-778r
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: memory leak in socket_server_send_reply() in src/os_unix.c
Solution: Free final in the error case when returning early
(Huihui Huang).
closes: #19627
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_recover_corrupted_swap_file1 fails on big-ending
systems (after v9.2.0077)
Solution: Skip the test on big-endian systems (James McCoy)
The POC files were generated on 64-bit little-endian systems and
therefore are not portable to any other system type.
Extract the 64-bit / endianness detection from
Test_recover_corrupted_swap_file() into a SetUp() function and use that
data to determine if the test should be run.
closes: #19620
Signed-off-by: James McCoy <jamessan@debian.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Potential buffer overflow in regdump()
Solution: Add the size to the compiled regular expression and ensure we
don't read over the limit.
Note: this is not a security issue, because regdump() is typically not
compiled in any version of Vim, so should not affect anybody.
supported by AI claude.
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: :tab accepts a tab address range but doesn't specify this in
the command specification.
Solution: Add EX_RANGE and EX_ZEROR to the command specification and use
ADDR_TABS (Doug Kearns).
As command modifers are handled separately before these flags are tested
in the ex-command parser they have no effect. However, it's better to
use an accurate description and the command specification table has uses
in other areas like runtime file generation for the Vim filetype.
closes: #19100
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Wayland: using _Boolean instead of bool type
Solution: Change type of variable (Christoffer Aasted).
related: #19473
closes: #19610
Signed-off-by: Christoffer Aasted <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: In a terminal window, line('w0') and line('w$') return wrong
values instead of the first and last visible line number,
because a terminal buffer does not go through the normal
redraw path that updates w_topline and w_botline (ubaldot).
Solution: Before computing w0 and w$, sync the terminal contents to the
buffer by calling may_move_terminal_to_buffer() so that
w_topline and w_botline are correctly updated.
fixes: #19585closes: #19615
supported by AI claude.
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: String handling can be improved
Solution: Pass string length where it is known to avoid strlen() calls,
do a few minor refactors (John Marriott).
This commit changes some calls to function `set_vim_var_string()` to pass
the string length where it is known or can be easily calculated.
In addition:
In `evalvars.c`:
* In function `set_reg_var()` turn variable `regname` into a C string
because that is how it used.
* Small cosmetics.
In `option.c`:
* Slightly refactor function `apply_optionset_autocmd()` to move some
variables closer to where they are used.
In `getchar.c`:
* Slightly refactor function `do_key_input_pre()`:
-> change call to `dict_add_string()` to `dict_add_string_len()` and
pass it the length of `buf`.
-> only call `get_vim_var_string()` once.
In `message.c`:
* Use a `string_T` to store local variable `p`.
In `normal.c`:
* Move some variables closer to where they are used.
closes: #19618
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_textformat.vim leaves swapfiles behind
Solution: Close open buffer using :bw! instead of :close!
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: With auto paragraph formatting enabled, when a user makes an
attempt to add a new word before the end of a line and with
the following space bringing the line width over 'textwidth',
the space ends up just getting swallowed by the editor.
Solution: Detect such a constellation and do not auto-format in that
case (Daniel Müller).
closes: #19593
Signed-off-by: Daniel Müller <deso@posteo.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK: gdk_pixbuf_new_from_xpm_data() is deprecated since
2.44.5, causing build warnings
Solution: Replace XPM icon loading with PNG byte arrays loaded via
g_memory_input_stream_new_from_data() and
gdk_pixbuf_new_from_stream(). These APIs are available since
GLib 2.12 and gdk-pixbuf 2.14 (around 2008) so should be safe
to use today.
fixes: #19446closes: #19583
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim still supports compiling on NeXTSTEP
Solution: Drop Support (Damien Lejay)
The NeXTSTEP operating system has been obsolete for decades. The
special-case code required to support it adds unnecessary complexity,
preprocessor conditionals, and non-standard workarounds to the codebase.
This commit removes all support for NeXTSTEP, simplifying the code and
build system in several ways:
- Replaced custom configure checks for `union wait` with a standard `AC_CHECK_FUNCS` call for `waitpid`.
- Removed all conditional code that used the non-standard `union wait` for process status, relying solely on a standard `int`.
- Replaced calls to the non-standard `wait4()` function with the POSIX-standard `waitpid()`.
- Cleaned up headers (`os_unix.h`, `os_unixx.h`) to remove NeXT-specific workarounds and macros.
- Removed obsolete NeXT compilation instructions from the INSTALL file.
This change improves maintainability and makes the Unix process handling code more linear and compliant with modern POSIX standards.
related: #18079
closes: #19582
Signed-off-by: Damien Lejay <damien@lejay.be>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: memory leak in list_extend_func() in list.c
Solution: Free l1 on early return (Huihui Huang)
closes: #19572
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_normal fails
Solution: Ensure the terminal width is 40 columns and also
check for existence of the tr.mo file
closes: #19608
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When initializing a window in win_init(), w_hl is reset to
NULL without ensuring existing highlight overrides are
cleared (after v9.2.0113)
Solution: Clear highlight overrides and reset w_hl in win_init(). Remove
the redundant VIM_CLEAR() from win_init_empty() (Foxe Chen).
closes: #19609
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When a popup info window is reused, win_init_empty() resets
w_hl to NULL without freeing the previously allocated value,
causing a memory leak (after v9.2.0113)
Solution: Free w_hl before resetting it to NULL in win_init_empty()
using the VIM_CLEAR() macro.
closes: #19607
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_wayland.vim fails when X11 is not available or
$XDG_RUNTIME_DIR is not defined
Solution: Skip test_wayland when prerequisites are not fulfilled
closes: #19579
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup: When an async redraw is triggered, the screen may flicker
because the terminal may render the intermediate states of the
redraw.
Solution: Enable synchronized output if possible to ensure the terminal
renders the entire update at once (Yasuhiro Matsumoto).
closes: #19584
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: terminal output may go to wrong terminal with
ConPTY
Solution: Explicitly disable inheriting the terminal handles
(gcrtnst).
closes: #19589
Signed-off-by: gcrtnst <52910071+gcrtnst@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: winhighlight pointer may be used uninitialized causing a crash
Solution: Initialize pointer in win_init() and win_init_empty()
(Foxe Chen).
closes: #19601
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup: windows flicker when updating text
Solution: Only refresh the popup mask if the position or size changed,
manually set the window redraw type instead of using
redraw_win_later() to avoid triggering a full screen redraw.
Handle opacity 100 correctly. Keep "firstline" sticky when
setting options (Yasuhiro Matsumoto).
related: #19510
closes: #19559
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: No support for terminal synchronization mode
Solution: Add DEC 2026 support using the 'termsync' option
(Foxe Chen).
related: #11718
closes: #19541
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: VIM_BACKTICK is always defined except for tiny builds
Solution: Remove the VIM_BACKTICK define and always compile backtick
expansion. This change however will cause the vim.tiny build
to be slightly larger (Martin Tournoij).
closes: #19562
Signed-off-by: Martin Tournoij <martin@arp242.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: byteidx_common() and f_utf16idx() are calling ptr2len() twice
per iteration, instead of reusing the already computed clen.
Solution: Reuse clen for pointer advancement in both functions
(Yasuhiro Matsumoto).
closes: #19573
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_statuslineopt() is flaky
Solution: Force a redraw earlier and read screen content directly using
screenstring() instead of g:ScreenLines() (Hirohito Higashi).
closes: #19571
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: memory leak in expand_findfunc() (after v9.1.0811)
Solution: Free list variable l on early return (Huihui Huang).
closes: #19564
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: memory leak in heredoc_get() in src/evalvars.c
Solution: Free variable l on early return (Huihui Huang).
closes: #19563
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup: flickering on opaque popups with overlapping text,
even if they are opaque (after v9.2.0016).
Solution: Prevent double redrawing by skipping background updates for
opaque popups. Revert changes to test dumps
(Javier Jaramago Fernández).
A flickering effect was introduced in commit v9.2.0016 (commit:
6c203072f) for all popups. This is a consequence of a double redraw of
the overlapping background characters. This could be expected for
transparent popups, but, it should exclude opaque ones. For a complete
fix of the flickering this commit is required in combination with fix
present in v9.2.0064 (commit: 97c5bed84b).
Additionally this commit reverts changes introduced for tests dumps for
masks in commits 6c203072f and cded5e220. These dumps were updated
preventing characters from popups to take into account the masks
specified for them. This forces the redraw of popup characters, even
when masks attempt to prevent them, leading to flickering effects. See
issues #19510 and PR: #19534.
closes: #19534
Signed-off-by: Javier Jaramago Fernández <jaramago.fernandez.javier@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: 'listchars' "leadtab" not used in :list (after 9.2.0088).
Solution: Also check for "leadtab" when using :list. Fix memory leak on
E1572 if "multispace" or "leadmultispace" is set (zeertzjq).
closes: #19557
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: A recent commit introduced a new function named
`update_highlight_overrides()` in `highlight.pro` and
`highlight.c`, one of the parameter names conflicts with the C++
keyword `new`. This causes compilation issues on Windows when
VIM is compiled with OLE enabled, as "if_ole.cpp" cannot compile
due to the conflict (after v9.2.0093).
Solution: Rename the parameter name of `update_highlight_overrides()`
from new to hl_new (Wei Tang)
fixes: #19568closes: #19558
Signed-off-by: Wei Tang <gauchyler@uestc.edu.cn>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Coverity complains about uninitialized var, also gcc warns
about a few other variables possibly being used uninitialized
(Tony Mechelynck, after v9.2.0093)
Solution: Initialize a few other variables.
Coverity CID: 1683101
closes: #19561
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Coverity: error handling issues in win_init() (after
v9.2.0093)
Solution: Only call pop_highlight_overrides() when
push_highlight_overrides() was successful.
CID: 1683100
related: #19561
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Memory leak in qf_push_dir() (after v9.2.0091)
Problem: free dirname, if it is not a directory.
closes: #19552
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: The has() function is slow because it performs a linear scan
of the feature list for every call.
Solution: Move common runtime checks and the patch-version parser to the
beginning of the f_has() function (Yasuhiro Matsumoto).
closes: #19550
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: In XTerm, typing Home, End, PgUp or PgDn on the editing pad
will cause vim to recognize <kHome>, <kEnd>, <kPageUp> or
<kPageDown> (keypad keys) instead of <Home>, <End>, <PageUp>
or <PageDown> (editing pad keys) respectively, affecting
mappings and the :terminal. This is caused because the keypad
termcaps are sorted before the editing pad ones in
termcodes, meaning vim will match the former if they are the
same.
Solution: Only recognize keypad keys when nothing else matches
(AstroSnail).
fixes: #17331closes: #19145
Signed-off-by: AstroSnail <astrosnail@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: In popup windows, concealed characters and tab expansion
may cause wrong truncation for fixed width windows.
Solution: Do not adjust the screen column and bogus column counters
for popup windows when handling concealed text or extra
padding characters (Yasuhiro Matsumoto).
closes: #19121
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Not possible to have window-local highlighting groups
(Hima)
Solution: Port Neovims 'winhighlight' option to Vim (Foxe Chen).
fixes: #3576closes: #19493
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: inside_block() iterates through all cstack levels
and returns TRUE when a CSF_BLOCK frame is found. For control
flow commands this causes '|' to no longer be
recognised as a command separator, breaking
"try | silent cmd | catch | endtry" (Martin Tournoij, after
v9.2.0072).
Solution: Return FALSE from inside_block() for control flow commands
that handle '|' themselves, so they always use '|' as
separator regardless of block nesting.
fixes: #19535closes: #19543
supported by AI claude.
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: "leadtab" behavior inconsistent on line with only TABs
(after 9.2.0088).
Solution: Don't consider those as leading TABs. Also add more tests for
existing behavior of "lead" and "leadmultispace" (zeertzjq).
closes: #19549
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>