Problem: possible heap-buffer-overflow when resizing the GUI
Solution: Check that the cursor position falls inside the GUI display
area (Foxe Chen).
closes: #20449
Supported by AI
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup: When the Popup highlight group has no guibg/ctermbg the
popup becomes fully transparent.
Solution: Create an entry if no popup_attr exists (highlight group
cleared for example), and test if popup_attr exists but
without guibg/ctermbg attributes to fallaback to normal bg
color.
closes: #20414
Signed-off-by: Shad <shadow.walker@free.fr>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: A needle that only matches past char 1024 gives an INT_MIN + 1
score with unset positions, e.g.
matchfuzzypos([repeat('a',1024)..'z'], 'az').
Solution: Drop the candidate when match_positions() returns SCORE_MIN.
closes: #20435
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: clientserver method needs to be given as argument
Solution: Add support for the $VIM_CLIENTSERVER environment variable,
which defines which clientserver method Vim should use
(Foxe Chen).
closes: #20409
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When only the title is changed with popup_setoptions(), the
popup is not redrawn until another event happens, so the new
title does not appear right away.
Solution: Redraw the popup when the title changes. Also allocate the new
title and border highlights before freeing the old ones, so the
current value is not lost on allocation failure.
fixes: #20426closes: #20430
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: Test_statusline() occasionally fails in CI, reading buffer text
instead of the status line (e.g. '9012...' instead of '57,39').
Solution: In s:get_statusline() redraw unconditionally and read the screen
cells directly with screenstring(), instead of relying on
ScreenLines() whose own redraw! can process events and change the
window layout between the redraw and reading the cells. This
matches the already-stable s:Assert_match_statusline() helper in
test_statuslineopt.vim.
closes: #20428
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: [security]: another possible code execution with python complete
(David Carliez)
Solution: Strip default expressions and annotations from generated
source for pythoncomplete and python3complete.
Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-65p9-mwwx-7468
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: In command-line completion with a popup menu ('wildoptions'
contains "pum"), the info popup shown next to the menu could
not be scrolled, unlike the Insert mode completion info popup
which scrolls with the mouse wheel.
Solution: When the mouse pointer is on top of the info popup, scroll it
with the mouse wheel in command-line mode as well, without
closing the completion popup menu.
closes: #20146closes: #20418
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: Using ":wqall" with a running terminal buffer can free the
buffer that is currently being iterated over in the buffer
list, resulting in a use-after-free (after v9.2.0593).
Solution: After stopping the job, check whether the buffer is still valid
and restart the iteration from the first buffer if it was freed
(Hirohito Higashi).
related: #20417
closes: #20423
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: srolljump=-100 only scrolls half a page going up, but works
fine going down. update_topline() always falls back to
scroll_cursor_halfway() when the cursor is far above topline.
Solution: Only center when sj is smaller than half the window. Otherwise
call scroll_cursor_top like the downward path does (glepnir).
fixes: #1527closes: #20366
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: any focus change on the drawarea turns the cursor
into an outline, including transient focus movement to a
GUI popup menu and back. The cursor flashes outline-shape
during menu interaction. The GTK3 GUI does not have this
problem because it ties the cursor shape to toplevel window
focus, not drawarea focus.
Solution: Gate focus_in_event() and focus_out_event() on
gtk_window_is_active() of the toplevel window, matching
GTK3 behaviour. Reverts v9.2.0588 (Foxe Chen).
closes: #20415
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: After a menubar popover (e.g. File, Edit) was opened and then
dismissed without selecting an item, keyboard focus remained
outside the drawing area, leaving the cursor stuck in the
unfocused (outline) shape until the pointer was moved over the
drawarea (Foxe Chen)
Solution: Install an emission hook on GtkPopover::closed and, when a
popover that descends from gui.menubar closes, queue an idle
callback that grabs focus back to the drawing area. The grab
must be deferred because GTK is still completing the close
transition when the signal fires (Yasuhiro Matsumoto).
fixes: #20274closes: #20291
Co-Authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: the drawarea is wrapped in a GtkOverlay with the
scrollbar form layered on top, so the left scrollbar
appears over the drawarea instead of beside it.
Solution: Place the drawarea and the scrollbars as siblings inside
the form widget, removing the GtkOverlay. Add
gui_mch_update_scrollbar_size() to query the actual
scrollbar dimensions and call it from gui_set_shellsize(),
rename GtkForm to VimForm so the GTK namespace is not used
(Foxe Chen).
closes: #20375
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Add float16_t, float32_t, float64_t, float128_t and bfloat16_t from
<stdfloat> as cppType under a new cpp_no_cpp23 guard.
fixes: #16498closes: #20367
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Crash with TextPut autocmd when pasting in normal mode in a
terminal buffer.
Solution: Skip the TextPut autocmds when reg and insert are both NULL
and regname is not '.' (Foxe Chen).
closes: #20407
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Move const, volatile, restrict and _Atomic to a new cTypeQualifier group
and inline and _Noreturn to cFunctionSpec. Add the C23 standard attributes
deprecated, fallthrough, maybe_unused, nodiscard, unsequenced and
reproducible as cStandardAttribute, and reclassify the existing noreturn
into the same group.
The new groups link to cStorageClass, so the default highlighting and any
existing cStorageClass override are unchanged, while allowing finer-grained
customization.
fixes: #19574closes: #20368
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Deleting a quickfix line and undoing it leaves the entry
pointing one line below where it should.
Solution: Don't shift already cleared entries in qf_mark_adjust.
closes: #20379
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: :popup, menu item show/hide and menu bar state
updates are not implemented.
Solution: Implement gui_make_popup(), gui_mch_menu_hidden() and
gui_mch_draw_menubar() (Foxe Chen).
closes: #20393
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Indent is not stripped in whole-line completion (CTRL-X
CTRL-L).
Solution: Skip the matched line's indent for whole-line matches in
search_for_fuzzy_match (glepnir).
closes: #20405
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: compile error when XFONTSET is defined
(simozz)
Solution: Undefine FEAT_XFONTSET when GTK4 UI is defined
(Foxe Chen)
fixes: #20404closes: #20406
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This depends on chrisbra/matchit#61 for full support of non-alphnum
heredoc markers.
closes: #20399
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: After maximizing and deleting the quickfix buffer, window
height is wrong (tertium)
Solution: Reset the winfixheight option when a quickfix buffer is
deleted from a window (Yegappan Lakshmanan)
fixes: #3378closes: #20403
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: With xxd the -R option colors the hex output but leaves the
binary output produced by -b uncolored (Boris Verkhovskiy)
Solution: Color the binary (bits) output per byte with the same colors as
the hex output, update the documentation and add a test
(Hirohito Higashi).
fixes: #20385closes: #20401
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: gui_mch_destroy_menu() never removed the entry from its
parent GMenu, so :unmenu was effectively a no-op against the
visible menubar model. After "Refresh menu" the Buffers menu
items doubled because runtime/menu.vim BMShow() re-appended
Refresh / Delete / Alternate / Next / Previous / -SEP- into a
still-populated GMenu. The GAction registered for the item
and the reference on its submenu GMenu were also leaked.
Solution: Compute the entry's position in the parent GMenu by walking
the vimmenu_T sibling list, call g_menu_remove(), remove the
GAction we registered, and release our reference on the
submenu GMenu (Yasuhiro Matsumoto)
fixes: #20262closes: #20314
Co-Authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: window size does not account for client-side decorations
Solution: Compute the client side decoration height from
gui_resize_shell() (Foxe Chen)
fixes: #20365closes: #20388
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup_create() is not gated by check_secure(), unlike the
similar deferred-callback registrars timer_start() and
feedkeys(). A popup created with a 'time' and 'callback' (or with
close/filter callbacks) registers code that runs after the secure/sandbox
context has been left, which is inconsistent with how
timer_start() and feedkeys() handle the same situation.
Solution: Call check_secure() at the top of popup_create(), matching the
timer_start()/feedkeys() pattern.
closes: #20400
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: filetype test for v9.2.0557 can be improved
Solution: Use a correct Kawasaki robot AS test file
(Patrick Meiser-Knosowski)
related: #20370
closes: #20387
Signed-off-by: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: missing test for v9.2.0572 (the patch accidentally
included some additional unwanted changes from #20372)
(thinca)
Solution: Add additional test for delfunc
(thinca)
Patch 9.2.0572 fixed ":call d.key()" and ":delfunction d.key" failing
with E1017 in Vim9 script, but only the :call form was covered by a
regression test. Add Test_delfunction_dict_funcref to exercise both
"delfunction d.key" and "delfunction d['k2']".
closes: #20372
Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Several Vim9 keywords lack EX_WHOLE and can be shortened in
Vim9 script, inconsistent with endif/enddef/endfor/endwhile/
endtry which already have it. The error from :endd in a
nested function also hardcodes "enddef" instead of reporting
what the user typed. fullcommand("ho") returns "horizontal"
even though :ho is below the documented 3-char minimum.
Solution: Add EX_WHOLE to :class, :def, :endclass, :endinterface,
:endenum, :public and :static. In get_function_body() pass
the user-typed command to the error message. Force :ho to
CMD_SIZE in find_ex_command() so fullcommand() reflects the
modifier minimum. Extend tests and documentation accordingly
(Peter Kenny).
fixes: #20032closes: #20191
Signed-off-by: Peter Kenny <github.com@k1w1.cyou>
Signed-off-by: Christian Brabandt <cb@256bit.org>