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>
The 32-bit context menu was not translated after 8ae45e4202.
NSIS requires a space after a `!`.
closes: #20396
Signed-off-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: With 'nowrap', when a line ends with a double-width character
exactly at the window width and has wrapping "after" virtual
text, the lines below disappear and "@@@" is shown.
Solution: Detect that the last character fills the rightmost column using
its displayed width (win_chartabsize(), so a <Tab> or double-width
character is handled like a single-width one), and also when it
overflows the last column. Also clarify in the help that "wrap"
only takes effect with the 'wrap' option set.
fixes: #20384
related: #12213
closes: #20395
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: compile_nested_function() calls define_function(), which registers
the new ufunc in func_hashtab with uf_refcount == 1. For a local
nested function the caller then reserves a local lvalue and
generates a FUNCREF instruction; if either step fails, the code
jumps to the theend label and leaves the ufunc behind with
refcount 1 and no external reference, leaking it. This mirrors
patch 8.2.3951, which fixed the same leak for the "text after
:enddef" branch a few lines above.
Solution: Call func_ptr_unref() on the ufunc before "goto theend" on both
failure paths in the local-variable branch (thinca).
closes: #20394
Co-Authored-by: Claude <noreply@anthropic.com>
Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: mouse wheel scrolling does not work correctly
Solution: Use gui_mch_getmouse() to obtain the pointer position, and
add GTK_EVENT_CONTROLLER_SCROLL_DISCRETE to the scroll
controller flags (Foxe Chen).
closes: #20389
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: In the bundled libvterm the CSI 8 ; rows ; cols t sequence reaches
on_resize() without validating its arguments. Missing, zero or
negative dimensions cause a negative-size memmove() in
resize_buffer() and out-of-bounds accesses in set_lineinfo() and
DECALN, all reachable from output rendered in a terminal window
(Yukihiro Nakamura).
Solution: Reject missing, zero or negative dimensions before calling
on_resize(). Also clamp a negative cell width in on_text() as
hardening for the bundled libvterm.
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: The security patch 9.2.0561 added a vim.eval() call inside
Completer.evalsource() to honor g:pythoncomplete_allow_import.
But the 'vim' module is only imported inside the outer
vimcomplete() / vimpy3complete() function, not at the script's
top level, so referring to it from a Completer method raises
NameError. The surrounding bare 'except' silently swallows
the error and leaves allow_imports at 0, meaning the opt-in
never takes effect -- 'import os' (and any other
buffer-level import) is always skipped, no candidates are
produced for 'os.<...>' and
Test_popup_and_preview_autocommand() fails on the Windows
CI matrix (Linux skips the test because Python 2 is absent).
Solution: Re-import 'vim' at the top of evalsource() in both
pythoncomplete.vim and python3complete.vim so the eval reads
the global, and set g:pythoncomplete_allow_import = 1 in the
test (it is the opt-in intended for callers that trust the
buffer contents) (thinca).
closes: #20386
Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When defining a dictionary function, the function name string
is allocated with vim_strnsave() but the result is not
checked. On allocation failure the dict entry is left with
type VAR_FUNC and a NULL name, and in the overwrite case the
previous entry has already been freed before the NULL is
stored.
Solution: Allocate the name before modifying the dict entry and bail out
on failure, freeing it on all error paths (thinca)
closes: #20376
Co-Authored-by: Claude <noreply@anthropic.com>
Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Corrected "Indian" to "India" for accurate naming.
closes: #20369
Signed-off-by: wangshuo <wangshuo@kylinos.cn>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: If got_int is true when win_close() is called, it unexpectedly
fails in the branch that detects failure in apply_autocmds().
This causes wingotofile in do_window() to duplicate current
window when do_ecmd() is aborted with got_int.
Solution: Fix do_window() to save the got_int value before trying to
close the split window (Yohei Kojima).
Steps to reproduce:
1. run `touch a && touch .a.swp && echo a > b && vim b`
2. Type `<C-w>f`
3. In the warning dialogue, type `a` to abort
4. Current window is duplicated
closes: #20382
Signed-off-by: Yohei Kojima <yk@y-koj.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Out-of-bounds read in update_snapshot() when a terminal cell
fills all VTERM_MAX_CHARS_PER_CELL slots (a base character
plus five combining marks): the loop over cell.chars[] has no
upper bound and libvterm leaves the array unterminated when full, so
it reads past the array and appends out-of-bounds values to a
buffer sized for only VTERM_MAX_CHARS_PER_CELL characters.
Solution: Bound the loop with i < VTERM_MAX_CHARS_PER_CELL, mirroring
the loop in handle_pushline() (Christian Brabandt).
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK4: tabline does not respond to mouse clicks
Solution: Connect on_select_tab() to "switch-page" to fire the tabline
event, and on_tab_reordered() to "page-reordered" to call
tabpage_move() with the new index (Foxe Chen).
closes: #20362
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GTK3/Wayland: crash with right mouse-button in tabline
Solution: Use gui.mainwin and get coordinates (Christoffer Aasted).
GtkNotebook (tabline) is a windowless container widget causing a
nullptr deref inside `gdk_window_get_effective_parent()` as Wayland
lacks a surface to anchor to.
fixes: #18864closes: #20348
Signed-off-by: Christoffer Aasted <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: Kawasaki Robots files are not recognized
Solution: Detect *.pg as kawasaki_as filetype, add filetype detection
for *.as as atlas or kawasaki_as filetype (KnoP-01).
In Kawasaki robots (https://kawasakirobotics.com/products-robots/)
AS language
*.pg is the extention for a program file and
*.as is for a complete backup.
closes: #20370
Signed-off-by: KnoP-01 <knosowski@graeffrobotics.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>