Commit Graph

19112 Commits

Author SHA1 Message Date
glepnir
589232c0e0 fix(extmark): wrong eol_right_align width calculation (#37034)
Problem: Multiple eol_right_align virtual texts with different widths
are incorrectly positioned. The lookahead loop uses `item` instead of
`lookaheadItem` when checking kind and accessing data, causing all
items to use the first item's width.

Solution: Use `lookaheadItem->kind` and `lookaheadItem->data.vt`
instead of `item->kind` and `item->data.vt` in the lookahead loop.
2026-01-23 08:35:43 +00:00
zeertzjq
cae4fbf973 vim-patch:3456303: check.vim: Use silent command modifier
Problem:  When checking a .po file (make -C src/po check), errors are not
          displayed.

Solution: Adding "silent" to some normal commands in check.vim
          suppresses unnecessary output (Muraoka Taro)

This is because the output of check.vim is redirected to /dev/null.
However, if you stop the redirection, check.vim generates a lot of
output and becomes very slow.

When these commands are run in ex mode, they output the contents of the
line the cursor is pointing to.  This caused a lot of output.

closes: vim/vim#19227

3456303430

Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
2026-01-22 13:41:01 +08:00
zeertzjq
5f86b4b70d vim-patch:4105ef1: Drop superfluous execute permissions for readable files
- runtime/ftplugin/plsql.vim (42e498)
- runtime/pack/dist/opt/editorconfig/LICENSE.PSF (e5e043)
- src/po/check.vim (96dab9)
- src/po/it.po (bb0d3b)

closes: vim/vim#18666

4105ef16e3

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2026-01-22 13:40:37 +08:00
zeertzjq
965f54cf50 vim-patch:96dab9c: check.vim: Further improve po message checks
96dab9c9b1

Co-authored-by: Antonio Giovanni Colombo <azc100@gmail.com>
2026-01-22 13:39:45 +08:00
zeertzjq
e27e4052c8 vim-patch:2566a9f: check.vim: Improve po message checks
2566a9f290

Co-authored-by: Antonio Giovanni Colombo <azc100@gmail.com>
2026-01-22 13:39:16 +08:00
zeertzjq
282a794feb vim-patch:41adebe: check.vim: detect trailing whitespace
41adebe572

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-22 13:36:57 +08:00
zeertzjq
5e6f0e58ed vim-patch:32a5faa: check.vim complains about overlong comment lines
Problem:  check.vim complains about overlong comment lines
Solution: only check the length of non-commented lines

32a5faa6d7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-22 13:35:32 +08:00
zeertzjq
95b6215f0a vim-patch:c858382: Problem: Commit 6f585d breaks CI
Problem:  Commit 6f585d breaks CI
Solution: Don't error out, simply return an error message.

c858382482

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-22 13:35:09 +08:00
zeertzjq
fc4188ded8 vim-patch:6f585da: Overlong translation files may cause repo to become "dirty"
Problem:  Overlong translation files may cause repo to become "dirty"
Solution: Add a test into check.vim to warn for lines being longer than
          80 virt columns

related: vim/vim#14490

6f585da00b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-22 13:34:52 +08:00
zeertzjq
196df35cca fix(terminal): <Ignore> should be no-op (#37494) 2026-01-22 09:26:22 +08:00
zeertzjq
25ce44845d fix(terminal): restore options properly when switching buffer (#37485) 2026-01-21 18:42:47 +08:00
glepnir
c556972ae1 fix(api): auto-load buffers in nvim_buf_set_* operations (#35046)
fix(api): auto-load buffers in nvim_buf_set_* operations

Problem: Setting marks, lines, or text on unloaded buffers fails because
ml_line_count is not accurate until the buffer is loaded.

Solution: Add require_loaded_buffer() helper and use it in write operations
(nvim_buf_set_lines, nvim_buf_set_text, nvim_buf_set_mark). These now
auto-load buffers as needed.
2026-01-21 14:17:44 +08:00
zeertzjq
1949452bd3 fix(tui): avoid using uv_pipe_t as uv_tty_t (#37479)
Check tui->out_isatty before accessing tui->output_handle.tty.
2026-01-21 11:53:18 +08:00
Tommy Guo
103ddaf9ae fix(lua): correct line number reporting for options set in coroutines (#37463) 2026-01-21 02:18:33 +00:00
James Fotherby
bfe9fa0f8e fix(socket): remove stale socket files (#37378)
Problem:
Crashed Nvim leaves socket files. Subsequent starts fail with "address already in use".

Solution:
On bind failure, test socket liveness via connect(). Remove if stale, retry bind().

Fixes #36581
2026-01-20 13:59:43 +08:00
glepnir
0712a9c87b fix(pum): separate scrollbar from shadow border (#37448)
Problem:
With shadow border, scrollbar and border overlap. Shadow's right border
starts from the second row (offset by 1), but scrollbar renders on every
row including the first. If they share a column, the first row shows
scrollbar where shadow hasn't started yet, causing misalignment.

Solution:
Separate scrollbar from the shadow's right border.
2026-01-19 19:39:48 -08:00
zeertzjq
64057d266c vim-patch:9.1.2098: Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A (#37466)
Problem:  Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A
          (after 9.1.1714) (fizz-is-on-the-way).
Solution: Check if there are matches before applying one (zeertzjq).

closes: vim/vim#19210

311b98d942
2026-01-19 23:36:57 +00:00
zeertzjq
b4e602dde5 vim-patch:9.1.2095: :wqall! doesn't quit when using :quit in BufWritePost
Problem:  :wqall! doesn't quit when using :quit in BufWritePost
          (after 8.0.1190).
Solution: Restore old value of "exiting" when calling not_exiting()
          instead of always resetting it to FALSE (zeertzjq).

related: vim/vim#2205
closes:  vim/vim#19212

e803ad1c56
2026-01-20 07:09:15 +08:00
zeertzjq
7470e63260 vim-patch:9.1.2097: TabClosedPre may be triggered twice for the same tab page
Problem:  TabClosedPre may be triggered twice for the same tab page when
          closing another tab page in BufWinLeave (after 9.1.1211).
Solution: Store whether TabClosedPre was triggered in tabpage_T
          (zeertzjq).

Also fix the inconsistency that :tabclose! triggers TabClosedPre after
a failed :tabclose, but :close! doesn't even if there is only one window
in the tab page.

closes: vim/vim#19211

9168a04e0c
2026-01-20 06:23:11 +08:00
zeertzjq
30bcb25341 vim-patch:9.1.2093: heap-use-after-free when wiping buffer in TabClosedPre
Problem:  heap-use-after-free when wiping buffer in TabClosedPre.
Solution: Check window_layout_locked() when closing window(s) in another
          tabpage (zeertzjq).

closes: vim/vim#19196

8fc7042b3d
2026-01-20 06:23:11 +08:00
zeertzjq
0d3ed7904a vim-patch:9.1.1211: TabClosedPre is triggered just before the tab is being freed
Problem:  TabClosedPre is triggered just before the tab is being freed,
          which limited its functionality.
Solution: Trigger it a bit earlier and also on :tabclose and :tabonly
          (Jim Zhou)

closes: vim/vim#16890

bcf66e0141

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2026-01-20 06:23:11 +08:00
zeertzjq
e3990f8643 vim-patch:9.1.1202: Missing TabClosedPre autocommand
Problem:  Missing TabClosedPre autocommand
          (zoumi)
Solution: Add the TabClosedPre autcommand (Jim Zhou).

fixes: vim/vim#16518
closes: vim/vim#16855

5606ca5349

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2026-01-20 06:23:11 +08:00
luukvbaal
8bdfd286e5 fix(messages): adjust msg_show "empty" kind logic (#37427)
Problem:  A message ending in an unprintable character may emit a
          msg_show event with the "empty" kind. No empty message event
          for echom "".
Solution: Adjust conditions for emitting "empty" msg_show events.
2026-01-19 17:15:44 +01:00
Emanuel Krollmann
f36dd7557a fix(autocmd): heap UAF with :bwipe in Syntax autocmd
Problem:
Creating an autocommand which executes `:bwipe` on the Syntax event
causes a heap-use-after-free.

Solution: set BF_SYN_SET flag before applying autocommands
2026-01-18 17:56:34 +00:00
glepnir
5a65321684 fix(pum): text overflows into border on truncation (#37438)
Problem:
When text is too long, it overflows into the border. This happens because
grid_line_maxcol includes border columns, so grid_line_puts can write
there.

Solution:
Truncate string to available width when need_fcs_trunc is set.
2026-01-18 08:55:30 +00:00
zeertzjq
41068c77aa fix(normal): assertion failure with "gk" in narrow window (#37444)
When width1 and width2 are negative the assertion may fail. It seems
that adding a negative value to w_curswant won't cause any problems, so
just change the assertion.
2026-01-18 11:46:13 +08:00
Sean Dewar
a5e5ec8910 fix(api): parse_expression crash with unopened ] and node
Problem: nvim_parse_expression null pointer dereference with unmatched ]
followed by a node.

Solution: if ast_stack was empty, set new_top_node_p to top of the stack after
pushing the list literal node; similar to what's done for curlies.

This bug was originally found by a Matrix user, but I couldn't remember how to
trigger it... Ran into the other crash while finding a repro. :P
2026-01-17 13:22:55 +00:00
Sean Dewar
5226801be2 fix(api): parse_expression crash with ident and curly
Problem: nvim_parse_expression null pointer dereference when parsing an
identifier followed by { with "highlight" parameter set to false.

Solution: only set opening_hl_idx if pstate->colors is not NULL.

Not added to parser_tests.lua as that uses highlight = true.
2026-01-17 13:22:55 +00:00
zeertzjq
f3cfe9a94b vim-patch:8.2.0371: crash with combination of terminal popup and autocmd (#37433)
Problem:    Crash with combination of terminal popup and autocmd.
Solution:   Disallow closing a popup that is the current window.  Add a check
            that the current buffer is valid. (closes vim/vim#5754)

cee52204ca

Cherry-pick related changes from patch 9.0.1454.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-17 11:53:58 +00:00
zeertzjq
960cba7b3b vim-patch:9.1.2090: Last buffer not freed with EXITFREE
Problem:  Last buffer not freed with EXITFREE (after 9.1.2087).
Solution: Free the last buffer when inside free_all_mem()
          (zeertzjq).

This isn't really a memory leak, as the last buffer's memory is still
reachable via pointers like firstbuf and lastbuf. But it's possible that
this may cause false ASAN warnings in the future, which is what EXITFREE
is supposed to prevent.

closes: vim/vim#19194

6c118afeaa
2026-01-17 18:37:48 +08:00
zeertzjq
eb5a7cc0dd vim-patch:9.1.2087: Crash when using :tabonly in BufUnload
Problem:  Crash when using :tabonly in BufUnload.
Solution: Set curbuf when setting curwin->w_buffer. Don't wipe out a
          buffer if there are no other buffers. Don't decrement
          b_nwindows if it was 0 before buf_freeall() (zeertzjq).

fixes:  vim/vim#19088#issuecomment-3710172769
closes: vim/vim#19186

fa64f92f6a
2026-01-17 18:37:47 +08:00
zeertzjq
e51f5e17e1 vim-patch:9.0.0909: error message for layout change does not match action (#37436)
Problem:    Error message for layout change does not match action.
Solution:   Pass the command to where the error is given. (closes vim/vim#11573)

9fda81515b

Thinking about this again, it's actually OK to check split_disallowed in
window_layout_locked(), so add the check.
Also add missing window_layout_locked() in tabpage_close().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-17 10:58:26 +08:00
zeertzjq
03494ad048 vim-patch:9.1.2088: Redundant NULL checks in find_pattern_in_path() (#37432)
Problem:  Redundant NULL checks in find_pattern_in_path().
Solution: Remove the NULL checks. Also fix typos in test_diffmode.vim
          (zeertzjq).

After assigning to inc_opt on line 2976, it's dereferenced immediately,
and not assigned another value afterwards, so checking for NULL after
line 2977 is redundant.

closes: vim/vim#19185

ce394b13e9
2026-01-17 06:34:34 +08:00
zeertzjq
dde914f926 Merge pull request #37422 from zeertzjq/vim-9.1.0059
vim-patch:9.1.{0059,0117,0671,1043,partial:1110}: WinNewPre
2026-01-16 16:18:02 +08:00
bfredl
4f44705a47 Merge pull request #37189 from bfredl/zigsafe
ci: test -Doptimize=ReleaseSafe
2026-01-16 09:14:54 +01:00
zeertzjq
786c5fbdec vim-patch:9.1.0671: Problem: crash with WinNewPre autocommand
Problem:  crash with WinNewPre autocommand, because window
          structures are not yet safe to use
Solution: Don't trigger WinNewPre on :tabnew

fb3f969936

Cherry-pick doc updates from latest Vim runtime.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-16 15:55:34 +08:00
zeertzjq
4544cec168 vim-patch:9.1.0117: Stop split-moving from firing WinNew and WinNewPre autocommands
Problem:  win_splitmove fires WinNewPre and possibly WinNew when moving
          windows, even though no new windows are created.
Solution: don't fire WinNew and WinNewPre when inserting an existing
          window, even if it isn't the current window. Improve the
          accuracy of related documentation. (Sean Dewar)

related: vim/vim#14038

96cc4aef3d

Most of the patch was already ported. This includes the remaining part.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-01-16 15:55:34 +08:00
zeertzjq
d6e5286d2c vim-patch:9.1.0059: No event triggered before creating a window
Problem:  No event is triggered before creating a window.
          (Sergey Vlasov)
Solution: Add the WinNewPre event (Sergey Vlasov)

fixes: vim/vim#10635
closes: vim/vim#12761

1f47db75fd

Not sure if this should be triggered before creating a floating window,
as its use case is related to window layout.

Co-authored-by: Sergey Vlasov <sergey@vlasov.me>
2026-01-16 15:55:33 +08:00
Jan Edmund Lazo
992eaac082 vim-patch:8.2.0370: the typebuf_was_filled flag is sometimes not reset (#37404)
Problem:    The typebuf_was_filled flag is sometimes not reset, which may
            cause a hang.
Solution:   Make sure typebuf_was_filled is reset when the typeahead buffer is
            empty.

e49b4bb895

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-01-16 15:11:07 +08:00
Sean Dewar
ba1d50fdc3 vim-patch:9.1.2086: Memory leak when skipping invalid literal dict
Problem:  memory leak when not evaluating (just parsing) invalid literal
          dict.
Solution: Always clear the key's typval (Sean Dewar)

Though "check_typval_is_value(&tv) == FAIL && !evaluate" is maybe never
true, also always clear tvs if check_typval_is_value fails; at worst
this would be a no-op as their initial types are VAR_UNKNOWN.

closes: vim/vim#19178

b10a3e1a20

check_typval_is_value change is for Vim9 script. (from 9.0.2163)

N/A patch:
vim-patch:9.0.2163: Vim9: type can be assigned to list/dict

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-01-15 23:21:33 +00:00
Sean Dewar
7e2e116343 fix(api): nvim_get_option_value dummy buffer crashes
Problem: nvim_get_option_value with "filetype" set can crash if autocommands
open the dummy buffer in more windows, or if &bufhidden == "wipe".

Solution: Attempt to close all dummy buffer windows before wiping. Promote the
dummy buffer to a normal buffer if that fails.
2026-01-15 20:08:45 +00:00
Sean Dewar
40114d1631 refactor: remove dead code, adjust comment
Removed code doesn't seem to do anything? Looks like a clobbered remnant from
when do_filetype_autocmd lived in did_set_string_option.

Doc comment for wipe_buffer doesn't decrement top_file_num since a2d25b7 (2016),
which presumably means the comment on marks doesn't apply either. (fmark_T::fnum
can't refer to the wrong buffer as numbers aren't reused here anymore)
2026-01-15 20:08:45 +00:00
Sean Dewar
3cb462a960 fix(api): autocmds mess up nvim_get_option_value's dummy buffer
Problem: When the "filetype" key is set for nvim_get_option_value, autocommands
can crash Nvim by prematurely wiping the dummy buffer, or cause options intended
for it to instead be set for unrelated buffers if switched during OptionSet.

Solution: Don't crash. Also quash side-effects from setting the buffer options.
2026-01-15 20:08:45 +00:00
bfredl
1427b94200 fix(typval): allocated dynamic size must be at least the static size
fixes #37160
2026-01-15 11:43:46 +01:00
zeertzjq
8c31b3eeac vim-patch:9.1.0702: Patch 9.1.0700 broke CI
Problem:  Patch 9.1.0700 broke CI
Solution: Revert for now

f459d68ecf

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-15 14:15:36 +08:00
zeertzjq
0de85e322a vim-patch:9.1.0701: crash with NFA regex engine when searching for composing chars
Problem:  crash with NFA regex engine when searching for composing chars
          (SuyueGuo)
Solution: When there is no composing character, break out of the loop
          and check that out1 state is not null

fixes: vim/vim#15583

c3a02d78bd

Test uses DBCS 'encoding', which is N/A.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-15 14:15:36 +08:00
zeertzjq
11b3699252 vim-patch:9.1.0700: crash with 2byte encoding and glob2regpat()
Problem:  possible crash with 2byte encoding and glob2regpat()
Solution: Skip over character, if it is multi-byte character

1c815b54bb

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-15 14:15:36 +08:00
Jan Edmund Lazo
5042394241 vim-patch:9.1.0697: [security]: heap-buffer-overflow in ins_typebuf (#37372)
Problem:  heap-buffer-overflow in ins_typebuf
          (SuyueGuo)
Solution: When flushing the typeahead buffer, validate that there
          is enough space left

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-4ghr-c62x-cqfh

322ba91086

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-15 13:35:21 +08:00
zeertzjq
e051718908 fix(process): don't limit PTY master remaining data size 2026-01-15 09:32:10 +08:00
zeertzjq
75c8f75501 refactor(process): don't read from PTY master using uv_pipe_t
Using uv_pipe_t to read from PTY master may drop data if the PTY process
exits immediately after output, as libuv treats a partial read after
POLLHUP as EOF, which isn't true for PTY master on Linux. Therefore use
uv_poll_t instead.

This commit can be reverted if libuv/libuv#4992 is fixed for uv_pipe_t.
2026-01-15 09:32:10 +08:00