Problem: xxd: color output detection is broken
(Juergen Weigert)
Solution: Fix the issues (Hirohito Higashi)
- Disable auto color when output goes to a file (two-argument form)
- Check TERM variable: disable color when unset, empty or "dumb"
- Add color_forced flag to preserve -R always behavior
- Add tests for the new behavior
fixes: #19790closes: #19813
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: memory leak in eval8()
Solution: Free type_list() even when evaluate is FALSE
(Huihui Huang)
closes: #19819
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: memory leak in change_indent()
Solution: Free orig_line in the error case
(Huihui Huang)
closes: #19820
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: memory leak in check_for_cryptkey()
Solution: Free cryptkey if it had been allocated
(Huihui Huang)
closes: #19821
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_visual_block_hl_with_autosel() is flaky on ASAN CI
(after v9.2.0221)
Solution: Add a TermWait() call
related: #19784
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Looking up highlight group names uses a linear scan of the
highlight table, which is slow at startup when many groups
are defined.
Solution: Use a hashtable for O(1) highlight group name lookup.
(Yasuhiro Matsumoto).
Benchmark (523 highlight groups, :highlight + highlight link + syntax
keyword + hlID() + redraw, 20 iterations):
master: 0.057 sec (~295,000 ops/sec)
this branch: 0.036 sec (~463,000 ops/sec)
speedup: ~1.57x
closes: #19788
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Highlight keywords "function" and "namespace" with
the "Keyword" group ("shFunctionKey").
- Highlight function body delimiters "{" and "}" with the
"Delimiter" group ("shFunctionExprRegion").
- Highlight function body delimiters "(" and ")" with the
"Operator" group ("shFunctionSubShRegion").
- Also, follow one style in folding all supported variants
of function bodies for grouping commands too by enclosing
a delimited function body, e.g. "{" and "}", in a fold and
leaving its function header, e.g. "function f()", out of
it when the header is written on a separate line.
To restore previous colouring, add to "after/syntax/sh.vim":
------------------------------------------------------------
hi link shFunctionKey Function
hi link shFunctionExprRegion Function
hi link shFunctionSubShRegion Function
------------------------------------------------------------
fixes: https://github.com/vim/vim/pull/19638#issuecomment-4052635546closes: #19638
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Changing the 'signcolumn' may cause flicker, because it uses
the P_RCLR flag for redrawing (Yggdroot)
Solution: Change 'signcolumn' to use P_RWIN instead of P_RCLR, matching
the behavior of 'number' and 'foldcolumn'
(Yasuhiro Matsumoto).
fixes: #19663closes: #19713
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: showmode message may not be displayed (Yee Cheng Chin)
Solution: Don't call char_avail() in skip_showmode(), but check
for anything in the stuff and typeahead buffer
(Hirohito Higashi).
Fix "-- VISUAL --" not shown when terminal responses are pending
When starting Vim with a script that enters Visual mode (e.g.
"vim -S script.vim"), the "-- VISUAL --" mode message sometimes
doesn't appear. This happens because skip_showmode() calls
char_avail(), which reads raw terminal input and picks up terminal
response escape sequences (e.g. t_RV response). Combined with
!KeyTyped (which is TRUE after script execution), this causes
skip_showmode() to return TRUE, preventing the mode from being
displayed.
Fix this by checking only the stuff buffer and typeahead buffer for
pending characters, instead of char_avail() which also reads raw
terminal input. This way, terminal response sequences no longer
interfere with mode display.
fixes: #16620closes: #19801
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
\a in Vim's regex matches [A-Za-z], not the BEL character (0x07).
This caused the OSC 8 hyperlink stripping pattern to incorrectly
match alphabetic characters, breaking man page display.
Use \x07 (inside []) and %x07 (outside []) to correctly match BEL.
closes: #19806
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: stack-overflow with deeply nested data in json_encode/decode()
(ZyX-I)
Solution: Add depth limit check using 'maxfuncdepth' to
json_encode_item() and json_decode_item() to avoid crash when
encoding/decoding deeply nested lists, dicts, or JSON arrays/objects,
fix typo in error name, add tests (Yasuhiro Matsumoto).
fixes: #588closes: #19808
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: test: Test_close_handle() is flaky
Solution: Use WaitForAssert() to wait for the channel to be closed
(Yasuhiro Matsumoto)
Ch_close_handle() did not wait for the channel to be fully closed,
which could cause Ch_CloseHandler to fire during the next test's
GetPort() sleep loop, resulting in E906.
Wait for ch_status() to become 'closed' before returning.
closes: #19797
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Compiler warning in strings.c
(Timothy Rice, after v9.2.0031)
Solution: Return early when str_m is zero
(Hirohito Higashi)
fixes: #19795closes: #19800
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: fileinfo not shown after :bd of last listed buffer
(memeplex)
Solution: Set need_fileinfo to true in empty_curbuf()
(Hirohito Higashi)
When deleting the last listed buffer with :bd, the new empty buffer's
file info (e.g. "[No Name]" --No lines in buffer--) was not displayed.
do_ecmd() only calls fileinfo() for existing buffers (oldbuf), not for
newly created empty buffers.
Set need_fileinfo in empty_curbuf() so the file info is displayed after
redraw.
fixes: #548closes: #19802
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: AROS/MorphOS/AmigaOS tiny/small link error
Solution: Include get_cmd_output by defining HAVE_LOCALE_H
(Ola Söder)
closes: #19792
Signed-off-by: Ola Söder <rolfkopman@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup: opacity not working across vert splits
Solution: Iterate over the full popup width to find all underlying
windows (Yasuhiro Matsumoto)
redraw_win_under_opacity_popup() only checked the popup's left column
to find underlying windows. When a popup spans a vertical split, the
right-side window was never forced to redraw, causing blended
ScreenAttrs values to accumulate across redraw cycles.
Iterate across the full popup width to find and redraw all underlying
windows.
closes: #19737
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: In XTerm, with 'xtermcodes' enabled (default), vim will
request keypad keys after editing pad keys, and will remove
the latter when they're duplicates of the former.
Solution: When a termcode reply is a keypad key and it would replace a
different key, skip it.
fixes: #19182 (case 2)
related: #19643
closes: #19644
Signed-off-by: AstroSnail <astrosnail@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: still possible flicker
Solution: Use redraw_as_cleared() instead of screenclear() to avoid
flicker (Yasuhiro Matsumoto).
When the window width matches the frame width, screenclear() causes
visible flicker. Use redraw_as_cleared() instead which marks the
screen for redraw without actually clearing it.
closes: #19732
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: CSI sequences may be written to screen
(after v9.2.0200).
Solution: Move the CSI parsing and skipping logic outside of the USE_VTP
guard in mch_write() so that sequences are always consumed
even if VTP is inactive (Yasuhiro Matsumoto).
After v9.2.0200 added send_decrqm_modes(), running vim -u NONE -U NONE
-N on Windows displays raw ESC[?2026$p on screen. This is because
USE_VTP is false when termguicolors is off and t_colors < 256, and the
CSI skip logic in mch_write() was inside the if (USE_VTP) block, so
s/len were never advanced and the escape sequence leaked out as plain
text.
Move the CSI parsing/skipping outside the USE_VTP guard so sequences are
always consumed. Only the vtp_printf() pass-through for DECSCUSR (q)
remains conditional on USE_VTP.
related: #19755
closes: #19762
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: No 'incsearch' highlighting support for :uniq
Solution: Add :uniq support (Hirohito Higashi)
closes: #19780
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: runtime(compiler): No compiler plugin for just
Solution: Add a compiler plugin for the just command runner, add a test
(Aditya Malik)
Sets makeprg and a custom errorformat to parse just's multi-line
error output into quickfix entries with file, line, column, and
message. Includes a test.
Reference:
- https://github.com/casey/justcloses: #19773
Signed-off-by: Aditya Malik <adityamalik2833@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: channel: 2 issues with out/err callbacks
Solution: fix indentation and output order with term_start()
(Hirohito Higashi).
When term_start() is called with err_cb (and optionally out_cb),
two issues occur:
1. Unexpected indentation in the terminal buffer display: stderr
arrives via a pipe which lacks the PTY ONLCR line discipline,
so bare LF moves the cursor down without a CR, causing each
subsequent line to be indented one column further.
2. stdout appears in the terminal and callbacks before stderr,
even when the child process writes to stderr first. This is
because channel_parse_messages() iterates parts in enum order
(PART_OUT before PART_ERR), so when both have buffered data
they are always processed in the wrong order.
Solution:
- In may_invoke_callback(), before writing PART_ERR data to the
terminal buffer, convert bare LF to CR+LF so that vterm renders
each line at column 0.
- In channel_parse_messages(), when about to process PART_OUT of a
terminal PTY job, if PART_ERR already has readahead data, skip
PART_OUT and process PART_ERR first. This works without any
artificial delay because channel_select_check() reads all ready
file descriptors into their readahead buffers in a single
select() pass before any callbacks are invoked; by the time
channel_parse_messages() runs, both buffers are populated and
the skip logic can enforce the correct order.
- Also add a per-line split for out_cb/err_cb on terminal PTY
jobs: instead of passing a potentially multi-line raw chunk to
the callback, split on NL and strip trailing CR so each callback
receives exactly one clean line.
Add Test_term_start_cb_per_line() to verify that err_cb and out_cb
each receive one line per call, with correct stderr-before-stdout
ordering, without any sleep between the writes.
fixes: #16354closes: #19776
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
I don't know whether it is necessary to copy desktop files to runtime/
manually, but these two files seem not to have been updated for some
time.
The change in Makefile is because the previous pattern will throw an error:
C:\msys64\ucrt64\bin\sed.exe: -e expression #1, char 3: unknown command: `.'
which I am not sure why.
closes: #19777
Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Option handling for key:value suboptions is limited
Solution: Improve :set+=, :set-= and :set^= for options that use
"key:value" pairs (Hirohito Higashi)
For comma-separated options with P_COLON (e.g., diffopt, listchars,
fillchars), :set += -= ^= now processes each comma-separated item
individually instead of treating the whole value as a single string.
For :set += and :set ^=:
- A "key:value" item where the key already exists with a different value:
the old item is replaced.
- An exact duplicate item is left unchanged.
- A new item is appended (+=) or prepended (^=).
For :set -=:
- A "key:value" or "key:" item removes by key match regardless of value.
- A non-colon item removes by exact match.
This also handles multiple non-colon items (e.g., :set
diffopt-=filler,internal) by processing each item individually, making
the behavior order-independent.
Previously, :set += simply appended the value, causing duplicate keys to
accumulate.
fixes: #18495closes: #19783
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: "zb" scrolls incorrectly with cursor on fold.
Solution: Set w_botline to the line below the fold (zeertzjq).
related: neovim/neovim#38413
closes: #19785
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: In Cygwin and MinGW, options like MODIFIED_BY cannot be set.
MSVC (Make_mvc.mak) allows you to build optional features
without modifying the source code by specifying DEFINES in the
nmake options. However, this is not the case in
Make_cyg_ming.mak.
Solution: Since DEFINES is used in many places, we will provide
EXTRA_DEFINES assuming that the user will define it. By adding
this to DEFINES, it will be possible to specify it in the same
way as in MSVC.
closes: #19786
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: call stack can be corrupted, because calculated remaining
capacity for call stack string can underflow (after v9.1.1983)
Solution: Calculate capacity against maximum capacity
(Sergey Vlasov).
closes: #19759
Signed-off-by: Sergey Vlasov <sergey@vlasov.me>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: The check for whether an X connection was opened was incorrect
(after v9.2.0158).
Solution: Use X_DISPLAY instead of xterm_dpy (Shane Harper)
Note: xterm_dpy would be NULL if Vim was started in GUI mode.
Previously, starting two instances of gvim that use GTK3 with:
GDK_BACKEND=x11 gvim and making a visual selection in both would leave
both selections highlighted with the Visual highlight group. Now, when
the second selection is made the first selection will be highlighted
with VisualNOS.
closes: #19752
Signed-off-by: Shane Harper <shane@shaneharper.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: cto files are not recognized
Solution: Detect *.cto as concerto filetype (Jamie Shorten)
Add filetype detection for the Concerto Modelling Language. Concerto
is a schema language by the Accord Project for defining data models
used in smart legal contracts and business networks.
Reference:
Language spec: https://concerto.accordproject.org
Tree-sitter grammar: https://github.com/accordproject/concerto-tree-sittercloses: #19760
Signed-off-by: Jamie Shorten <jamie@jamieshorten.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: Rendering artifacts with DirectX
(Alexander Zhura)
Solution: Force redraw (Yasuhiro Matsumoto)
DirectWrite subpixel rendering (especially with CFF/OTF fonts) can
extend glyph pixels beyond cell boundaries. Vim already handles the
forward direction (redraw the next character when the current one
changes) for MS-Windows antialiasing, but the backward direction was
missing.
Add gui.directx_enabled flag accessible from screen.c and extend the
existing spill-over handling to:
- Redraw the current character when the previous one changed (backward)
- Force redraw of the next character in screen_puts_len() and
screen_fill() paths
fixes: #19586closes: #19761
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_gui_system_term_scroll() is flaky
(after: v9.2.0208)
Solution: Fix test (Yasuhiro Matsumoto)
Remove timer-based screen check and use a simple command instead
of ping. The timer could fire before ConPTY initialization was
complete, causing screenstring() to return an empty string.
Check screenstring() directly after the command finishes instead.
related: #19735
closes: #19765
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Crash when using a partial or lambda as a clipboard provider
Solution: Don't call free_callback() from clip_provider_get_callback()
(Shane Harper).
closes: #19766
Signed-off-by: Shane Harper <shane@shaneharper.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: version packing may overflow (after v9.2.0206)
Solution: Explicitly clamp the version components using min()
(Mao-Yining).
The version components (major, minor, build) from RtlGetVersion are now
clamped to their maximum bit widths (8 bits, 8 bits, 15 bits) before
being packed into a 32-bit integer. This prevents overflow when storing
unexpectedly large values.
This fixes a regression introduced in patch 9.2.0206 where the previous
clamping logic was accidentally removed.
The MAKE_VER macro is simplified by removing bit masks, as clamping is
now done at the call site, making the macro clearer and reducing
redundant masking.
closes: #19769
Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Normalize white space in the "menu Help->Sponsor" message across all
translation files and the version.c intro handler. This ensures
consistent column alignment when displayed in the user interface.
related: #19771
Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: possible crash when setting 'winhighlight'
Solution: Validate the option value more carefully (Foxe Chen)
closes: #19774
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_xxd tests are failing, after changing the xxd
manpage (after v9.2.0205)
Solution: Update the manpage, shorten the date and update the example,
regenerate the expected test output, skip the first 30 bytes
for the one of the xxd tests (Muraoka Taro)
Some of the Test_xxd tests depend on the contents of xxd.1. The patch
9.2.0205 changed xxd.1, but the test fixes were insufficient. The test
that dumps the beginning of xxd.1 and the test that reads 13 bytes
starting from byte 0x33 from the beginning were failing.
closes: #19763
Co-authored-by: James McCoy <jamessan@debian.org>
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim may freeze if setcmdline() is called while the wildmenu or
cmdline popup menu is active (rendcrx)
Solution: Cleanup completion state if cmdbuff_replaced flag has been set
(Yasuhiro Matsumoto)
fixes: #19742closes: #19744
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>