Problem: In the GTK4 GUI the undercurl is drawn by building a path
across the whole width of each decorated row. With many
undercurls on screen this causes frame drops.
Solution: Render a single cycle of the undercurl and tile it across the
row with a repeating node, so the Vulkan and OpenGL
renderers can repeat directly (Foxe Chen).
closes: #20829
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: 'showcmd' not redrawn with empty mapping triggered on timeout.
Solution: Don't postpone redraw when inside vgetorpeek(). Also move test
for tabline 'showcmd' to test_tabline.vim.
fixes: #20839closes: #20840
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
'spellcapcheck' checks the first word in the file for a capital like any
sentence start: capcol is seeded to 0 for line 1 in spell_check_sblock().
This has been the case since the feature was added in v7.0100, so the note
that it "doesn't work for the first word in the file" is incorrect.
related: f9184a1d31 (code change)
related: 0d9c26dd83 (initial doc patch,
just a few minutes later)
related: #20715
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Memory leak when a spell file has an SN_SAL section before an
SN_SOFO section: set_sofo() reuses sl_sal without freeing the
salitem_T entries left by read_sal_section() (after v9.2.0846).
Solution: Factor the SAL free loop into free_sal_items() and call it
before set_sofo() reuses sl_sal.
closes: #20836
Supported by AI.
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup: popup images do not support scaling
Solution: Add popup scaling support for GTK4 UI
(Foxe Chen).
closes: #20611
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Focus autocommands triggered inconsistently
Solution: Suppress dialog-generated focus events while a dialog is
active and on X11 ignore the restoring focus_in_event()
from closing a dialog (Christoffer Aasted).
closes: #20780
Signed-off-by: Christoffer Aasted <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: On MS-Windows commands sent by a client in quick succession,
e.g. repeated "--remote-tab", can be lost: the files are not
all opened (eight)
Solution: In the GUI the client message is handled re-entrantly, e.g.
while a command line is being read during a redraw. Inserting
the received keys into the typeahead buffer then corrupts it.
Postpone inserting the keys until a safe point where the
typeahead buffer is empty (Hirohito Higashi).
fixes: #20810closes: #20816
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When a tagfunc returns a "cmd" that is neither a line number nor
a search pattern, the tag entry is corrupted: the "kind" field is
lost and taglist() returns a mangled "cmd".
Solution: Accept any Ex command in "cmd" as in a tags file, terminate a
generic command with a bar so the trailing fields are preserved,
and reject a value that cannot be stored in a tag line with E987
(Hirohito Higashi).
fixes: #20781
related: #20790
closes: #20828
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Update the Go syntax file with some recent changes made to vim-go to
correctly highlight the second and later lines of concatenated strings
in var or const blocks.
closes: #20835
Signed-off-by: Billie Cleek <bhcleek@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: heap buffer overflow in set_sofo()
(Yazan Balawneh)
Solution: Reset sl_sal_first (Yasuhiro Matsumoto).
A crafted spell file with an empty SN_SAL section before an SN_SOFO
section reaches set_sofo() with sl_sal_first[] already set to -1 by
set_sal_first(). The counting loop then under-counts colliding
multi-byte "from" characters, allocates an undersized list and writes
past its end.
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-9jqx-hgpr-6v64
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: arbitrary Ex command execution during C
omni-completion (Threonine)
Solution: Match tags typeref literally to block Ex command injection
(Yasuhiro Matsumoto).
Escaping only "/" and "\" left the typeref able to break out of the
:vimgrep pattern without a "/": an unclosed "[" makes vimgrep's pattern
skipping fail, and the parser then treats a following "|" as a command
separator, so the tag value runs as Ex commands during C omni-completion.
Match the field literally with \V so no regex metacharacter can affect
pattern parsing.
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-cx73-phcg-3j5g
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: use-after-free on json decode error
(@tdjackey)
Solution: Report the position from the current reader
(Matsumoto Yasuhiro)
json_decode_item() caches "p" into js_buf, but json_decode_string() can
refill via channel_fill(), which frees the old js_buf. When the string
parse then fails (e.g. an invalid \u escape), the shared error path passed
the now-dangling "p" to semsg(), a heap use-after-free read reachable
pre-auth through the socketserver.
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-69ch-22ch-r887
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: A "clipwindow" popup with "opacity" anchored to a
text property can keep a negative window row when the anchor
scrolls above the top of the host window. The opacity mask
loop then indexes the screen array before its start, causing
an out-of-bounds read and a conditional out-of-bounds write
(tdjackey).
Solution: Keep the popup window row at the first visible row and record
the clipped-off top rows only in the top offset, so no
consumer has to clamp the row and the opacity mask loop stays
in bounds (Hirohito Higashi).
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-pmvp-6rcj-98p4
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: code injection in netrw via bookmarks and history
(David Carliez)
Solution: Escape the '|' explicitly (Yasuhiro Matsumoto)
The bookmark and history menu builders interpolate paths into :execute'd
:menu commands using g:netrw_menu_escape, which did not escape the Ex
command separator '|'. A crafted path could break out of the :menu command
and run arbitrary Ex/shell commands when the menu was built or triggered.
Add '|' to g:netrw_menu_escape for the menu names, escape the :e right-hand
side with fnameescape(), and quote the netrw#MakeTgt() argument with
string() instead of raw single-quote interpolation.
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-rcr7-f3wr-22r2
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: arbitrary code execution via keyword lookup in
sh.vim, zsh.vim and ps1.vim filetype plugin
(manus-use)
Solution: For powershell, quote the commands using single quotes, for
sh/zsh pass the argument as a separate list item to term_start()/system()
(Yasuhiro Matsumoto).
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-r5v6-q6j8-8qw2
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Using wrong colors in hl_blend_attr()
(after v9.2.0715)
Solution: Use the correct background color
(Shad)
related: #20624
closes: #20704
Signed-off-by: Shad <shadow.walker@free.fr>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: .git-blame-ignore-revs file is not recognized
Solution: Detect .git-blame-ignore-revs file as gitrevlist filetype,
include syntax and filetype plugins (Fionn Fitzmaurice)
A Git revision list is
> a list of object names (i.e. one unabbreviated SHA-1 per line)...,
> comments (#), empty lines, and any leading and trailing whitespace are
> ignored.
(from Git's fsck.skipList documentation).
The default output of git rev-list will match this. It is also suitable
as input to git blame --ignore-revs-file.
This adds filetype detection matching .git-blame-ignore-revs files,
syntax highlighting and basic filetype settings.
closes: #20702
Signed-off-by: Fionn Fitzmaurice <fionn@github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: features in version.c are not sorted
Solution: Sort features case-insensitively (Taro Muraoka)
closes: #20717
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: cleared last search pattern is restored from viminfo
Solution: Do not apply the search pattern and 'hlsearch' state read
from viminfo while writing (Barrett Ruth).
fixes: #20718closes: #20720
Signed-off-by: Barrett Ruth <br@barrettruth.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: menu mnemonics do not work properly
Solution: Force "mnemonics-visible" back on via a notify handler and
set the active item on "mnemonic-activate" (Foxe Chen).
closes: #20722
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Opening a file from a netrw listing throws
"E471: Argument required: keepj keepalt 2wincmd 1" when
g:netrw_chgwin equals winnr('$')+1, e.g. after opening
:Lexplore (which sets g:netrw_chgwin=2) and closing the
sidebar, then browsing with :Explore in the remaining window.
s:NetrwBrowseChgDir builds the window jump as
"g:netrw_chgwin wincmd curwin", passing the saved window
NUMBER where wincmd expects its single-letter argument.
Solution: Jump back to the saved window with "curwin wincmd w", as the
surrounding comment intends; the following statement then
performs the actual jump to g:netrw_chgwin.
The faulty line dates back to at least Vim 9.0
(runtime/autoload/netrw.vim:4976 at v9.0.0000).
Reported (against the since-archived netrw repo) in
saccarosium/netrw.vim#98 and neovim/neovim#34169.
Note: no test, because the error reproduces only in Neovim.
closes: #20741
Signed-off-by: erdivartanovich <erdivartanovich@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When several clients send a command in quick succession, e.g.
":drop" from repeated "--remote-tab", the commands can be
processed in reverse order, so the files open in the wrong
order.
Solution: The server inserts a newly accepted client at the head of the
client list, so pending clients are handled newest-first.
Append the client to the end of the list instead, so they are
handled in the order they were accepted (Hirohito Higashi).
closes: #20813
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: diff highlighting hard to read with syntax enabled and
terminals having 256 or less colors (Andrey Butirsky)
Solution: Set a cterm foreground color (Maxim Kim)
fixes: #4071closes: #20711
Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When the terminal reports no colors ("t_Co" is 0 or 1) the
insert mode completion popup menu is not shown at all, while
the command line completion popup menu ('wildoptions' contains
"pum") is shown. In 'wildmenu' completion the current match
cannot be told apart from the other matches (Maxim Kim)
Solution: Show the insert mode completion popup menu regardless of the
number of colors and add "term" attributes to the default
highlighting of Pmenu, PmenuSel and PmenuThumb. The wildmenu
is drawn with the attributes of the status line, which is
reversed, and on most terminals the standout mode is the same
as the reverse mode, thus use the underline mode for the
default highlighting of WildMenu (Hirohito Higashi).
fixes: #20800closes: #20803
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
1. new colorscheme `novum` port of nvim dev_theme
2. minor updates to
- catppuccin
- habamax
- lunaperche
- retrobox
- ron
- shine
- wildcharm
closes: #20723
Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Sessions do not preserve script version for option holding
expressions
Solution: Remember script version for string options, and add a
":legacy" prefix for ":set"/":setlocal" calls when necessary
Since patch v9.2.0579 (":mksession, :mkview and :mkvimrc emit legacy Vim
script") session files are marked as Vim9 script. A few options have
Vim expressions as their values. When inserted their values literally
into a Vim9 script, these expressions are now evaluated as Vim9
expressions. But the original value might have been set by a legacy
script.
In order to be backward compatible and not break most of the existing
file type plugin scripts, we need to consider the script version of the
option value. If an option was set in a legacy script, or via "legacy
set"/"legacy setlocal", we need to restore it using the "legacy" prefix
as well.
Options are not marked as expression options, vs string options, vs bool
options. We only know if an option is a bool, number or a string
option. It seems safe to set bool and number options using Vim9
semantics. But for string options we do not know if an option value is
a Vim expression. And so, if it was set by a legacy script we just
use a conservative approach and prefix the "set" or "setlocal" command
with "legacy" for all string options set in a legacy context.
related: #20152
closes: #20696
Signed-off-by: Illia Bobyr <illia.bobyr@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Current method can't work in Windows Terminal as far as I know.
This is a way that already had been adopted in `dist/vim9.vim`.
closes: #20714
Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: hardware rendering can be improved
Solution: Refactor code (Foxe Chen)
This change does the following:
- Make each cell have its own array of glyphs, that represent it. Before
glyphs were stored per span of drawn text.
- Background color, invert blend is now stored as a single row pixel
buffer, that is scaled up to size when rendering. No need to have logic
for merging visual attributes together.
- Underlines, undercurls, and strikethroughs use a mask outline, and a
pixel buffer (similar to the above) that is opaque at parts where there
are under decorations. This means having 100 individual undercurls that
are all separated by spaces in a row will only result in a single mask
node.
- Render nodes are cached per row, because creating render nodes are
cheap. The actual heavy stuff would be shaping text into glyphs, which
are cached per cell.
- Use PangoAttrFontFeatures to handle guiligatures option, instead of
manually splitting draw calls, which is buggy and complex (some complex
unicode characters are not rendered correctly).
- Render block cursor separately, this prevents a full redraw of the text
for the row the cursor is on (only if glyphs in cell underneath cursor
did not change).
Complex unicode characters that bleed outside of the cell should look
better, since the background is always rendered before all glyphs,
meaning they are not clipped off.
fixes: #13435closes: #20674
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: ":startinsert" enters Insert mode in a buffer where
'modifiable' is off, the error only appears when a character
is typed. Typing "i" gives the error right away (Barrett Ruth)
Solution: Give the error when the buffer is not modifiable, like "i"
does. Keep ignoring the command in a terminal window, where
":startinsert" is documented to be ineffective, and keep
accepting it when 'insertmode' is set, like "i" does
(Hirohito Higashi).
fixes: #20804closes: #20806
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: highlighting for broken terminals can be improved
(Maxim Kim)
Solution: Make the highlighting work better when the terminal does not
support colors (Maxim Kim)
In a colorless or broken terminal emulator current syntax highlighting
is too intense with using bold and underline for various syntax
elements.
In this scenario, when the colors are not available at all, the most
important part of the syntax is the comments, something that is not
executed or compiled.
- Comments are highlighted as bold
- All other syntax elements are set to NONE
- LineNr is not highlighted (was underline)
- SpecialKey is not highlighted (was bold)
fixes: #20712closes: #20799
Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: With the NFA engine a sub-expression inside a variable width
look-behind, e.g. "\v(.)@<=", is empty for the first match on
every line except the first one. The old engine is correct
(Mukundan)
Solution: The look-behind is retried from the previous line, because the
width of "." is over-estimated. While scanning that line the
start state is added at the end of the line, where it gets the
position of the line break as its start position, even though
the match actually starts on the next line. Use the position
of the start of the next line in that case (Hirohito Higashi).
fixes: #20802closes: #20805
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>