Commit Graph

20026 Commits

Author SHA1 Message Date
marvim
4a7c621cf8 docs: update version.c
vim-patch:9.1.0001: tests: Test_popup_setbuf() fails
vim-patch:9.2.0018: high cpu usage with Wayland compositor
vim-patch:472f46e23 README.md: mention r/vim and #vim libera
vim-patch:dbd924f6a runtime(syntax-tests): Fail when executable syntax tests are found
vim-patch:70a9273dc Filelist: Fix CI error caused by xdg.vim missing in Filelist
vim-patch:405ba5010 runtime(doctags): remove unused header include file
vim-patch:47eb32fc9 translation(zh): Update menu translation for changed "Sponsor" entry
2026-02-20 03:53:00 +00:00
zeertzjq
6e8a1a8988 vim-patch:9.2.0032: completion: hang with line completion and fuzzy
Problem:  completion: hang with line completion and fuzzy (Jesse Pavel)
Solution: Only check the line number when wrapping around the file
          (Hirohito Higashi).

fixes:  vim/vim#19434
closes: vim/vim#19443

d8648f7279

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2026-02-20 09:01:20 +08:00
zeertzjq
08b8fe5ab3 vim-patch:9.2.0030: completion: non-prefix matches shown when leader is NULL
Problem:  When 'autocomplete' fires before compl_leader is initialized,
          the prefix filter is bypassed. This allows non-prefix matches
          (e.g. from fuzzy omnifuncs) to be shown in the popup menu and
          incorrectly preinserted.
Solution: In get_leader_for_startcol(), if compl_leader.string is NULL,
          fall back to using compl_orig_text as a filter for matches
	  starting at or after the completion column (Hirohito Higashi).

When 'autocomplete' first fires, compl_leader is NULL because
ins_compl_start() has not set it yet.  This caused the prefix filter in
ins_compl_build_pum(), find_next_completion_match() and
find_common_prefix() to be bypassed, allowing non-prefix fuzzy omnifunc
matches to appear in the PUM and be preinserted.

Extend get_leader_for_startcol() to fall back to compl_orig_text when
compl_leader.string is NULL: if the match's cpt source startcol is less
than compl_col the match includes pre-compl_col text, so return
&compl_leader (NULL string) to signal "pass through"; otherwise return
&compl_orig_text so callers filter by the original text.  The compl_col
<= 0 guard is kept only for the prepend-text path to avoid it
interfering with the NULL-leader fallback when compl_col is zero.

With this change all callers of get_leader_for_startcol() automatically
receive the correct filter string without additional helpers.

Also update Test_autocomplete_trigger Test 9 to reflect the new
behavior: 'faberge' is no longer shown when completing 'foo' because
it does not start with the current prefix.

Add Test_autocomplete_preinsert_null_leader() to verify that only
prefix-matching candidates appear in the PUM and are preinserted.

fixes:  vim/vim#19328
closes: vim/vim#19447

a04ae0210b

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 08:58:41 +08:00
zeertzjq
785ac9f228 vim-patch:9.2.0028: matchadd() conceal may use unrelated syntax cchar (#37974)
Problem:  matchadd() conceal may use unrelated syntax cchar.
Solution: Only use syntax cchar when syntax_flags has HL_CONCEAL
          (zeertzjq).

closes: vim/vim#19459

d01f234ec1
2026-02-19 22:51:31 +00:00
luukvbaal
2de284e50b fix(message): set replace_last for completion "scanning" messages #37967
Problem:  UIs put ins-completion "scanning" messages one after another,
          which are meant to overwrite the previous message.
Solution: Ensure the msg_show "replace_last" parameter is set.
2026-02-19 16:01:43 -05:00
zeertzjq
e142e01d57 fix(rpc): include write failure reason in log (#37959)
Also don't use LOGLVL_ERR on UV_EPIPE.
2026-02-19 10:34:22 +08:00
zeertzjq
fadf5fc8db vim-patch:9.2.0024: Reading files with very long lines crashes with a segfault
Problem:  Reading files with lines approaching MAXCOL length crashes
          with segfault due to colnr_T overflow.
Solution: The split check 'linerest >= MAXCOL' fired too late because
          linerest could grow by up to 'size' bytes before the next
          check. Change threshold to 'linerest >= MAXCOL - size' to
          ensure the line passed to ml_append() stays within colnr_T
          range.

Note: supported by AI claude

fixes:   vim/vim#17935
closes:  vim/vim#18953
closes:  vim/vim#19332

6cc291da06

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-19 08:19:44 +08:00
zeertzjq
134782b99e vim-patch:9.2.0023: fix integer overflow in ml_append_int() for long lines
Problem:  ml_append_int() crashes when appending lines near MAXCOL
          length due to signed integer overflow in space_needed
          calculation.
Solution: Change 'space_needed' from int to long to handle the
          'len + INDEX_SIZE' computation without overflow. Update
          db_free comparison casts from (int) to (long) to match.

Note: supported by AI claude

related: vim/vim#17935
related: vim/vim#18953
related: vim/vim#19332

0ece393844

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-19 08:19:44 +08:00
zeertzjq
ac84a3f3b6 vim-patch:9.2.0020: Wrong shortened buffer after :cd with duplicate slashes (#37955)
Problem:  Wrong shortened buffer name after :cd with duplicate slashes.
Solution: Skip over multiple consecutive path separators (zeertzjq).

related: neovim/neovim#37080
closes:  vim/vim#19444

f245e17ac7

N/A patches:
vim-patch:9.0.1859: heap-use-after-free in bt_normal()
vim-patch:9.2.0022: bt_quickfix() is slow
2026-02-19 07:46:10 +08:00
zeertzjq
2154d325d5 fix(memfile): avoid potential crash on OOM (#37946)
When running out of memory in a libuv callback, try_to_free_memory()
will call mf_release_all(). In this case, mf_sync() cannot call
os_breakcheck() as it'll run the libuv loop recursively, so check
main_loop.recursive to prevent that.

Also fix another possible problem that a terminal buffer may have a
swapfile when encountering an OOM in e.g. terminal_alloc().
2026-02-19 06:07:16 +08:00
Justin M. Keyes
0e4fa55200 Merge #37928 prompt-buffer cursor, undo 2026-02-18 14:19:25 -05:00
Justin M. Keyes
abfe6c9ef7 feat(logging): rename ".nvimlog" => "nvim.log" #37935
- Rename ".nvimlog" to "nvim.log"
  - doesn't need to be "hidden"/dotfile
  - ".log" extension helps with filetype detection
- Also rename "nvim/log" => "nvim/nvim.log"
2026-02-18 11:58:34 -05:00
bfredl
fa9e071b83 Merge pull request #37826 from glepnir/hl_underline_int_overflow
fix(highlight): blend underline check and use 64-bit key for attr cache to support 32-bit attr values
2026-02-18 09:46:41 +01:00
Rahul Yedida
9492df027d fix(defaults): 'guifont' "monospace" fallback, trim spaces #37930
Problem:
Some UI clients break if space follows the comma in 'guifont' items.
Also the new 'guifont' default may cause problems if none of the fonts are found.

Solution:
Remove trailing whitespace. 
Add a "monospace" fallback which `fontconfig` can resolve on *nix systems.
2026-02-18 01:57:59 -05:00
github-actions[bot]
456fb08542 docs: update version.c #37784
vim-patch:2e9db8fa9 runtime(doc): add Swedish entries to Make_all.mak, add conversion rule to Makefile
vim-patch:776b07000 installman: Update the sed patterns in installman.sh
vim-patch:9fe5a1d55 runtime(doc): Use ellipses for overlength example comments at :help vim9.txt
vim-patch:75541da4c runtime(doc): Update todo.txt and remove solved issues
vim-patch:9.1.0001: tests: Test_popup_setbuf() fails
vim-patch:4cae20c47 README: Updated version from 91 to 92 in various READMEs
vim-patch:93f05b6d4 Makefile: dosrt target fails because of duplicate lang directories
vim-patch:9.2.0008: MS-Windows: font size calculation may be wrong
vim-patch:9.2.0010: Using Wayland compositor is still slow
vim-patch:9.2.0012: Build fails when wayland is not defined
vim-patch:9.2.0013: parallel make invocation may break Wayland header generation
vim-patch:823f4f12b proto: make proto doesn't handle bool type correctly
2026-02-18 01:53:15 -05:00
Sean Dewar
a5eb023a53 fix(prompt): clear undo when changing/appending prompt
Problem: undoing after the prompt is changed breaks it (and causes init_prompt
to abort it and append a new one), as the undo history contains the old prompt.

Solution: like submitting, clear the undo buffer. Don't do it in init_prompt if
the line was empty; that may not result in a new prompt, and causes commands
like "S" to lose the history.

As u_save, etc. wasn't being called by prompt_setprompt, undoing after it fixes
the prompt usually gave undesirable results anyway.

Remove the added undo_spec.lua test, as its approach no longer works as a repro,
and finding a new one seems fiddly.
2026-02-17 23:43:37 +00:00
Sean Dewar
602cbbe1d9 fix(prompt): prompt_setprompt cursor col adjustment
Problem: prompt_setprompt adjusted cursor col may be negative (<=0 when
1-based), and doesn't check the col of ':

Solution: avoid negative col and adjust correctly if ': col differs from old
prompt's length.
2026-02-17 23:43:05 +00:00
zeertzjq
f3feae0bbf fix(terminal): crash after deleting buffer lines (#37921)
Problem:  Terminal crashes after deleting buffer lines.
Solution: Don't insert lines above lines 0.
2026-02-17 13:00:13 +00:00
glepnir
bd12aef784 fix(highlight): refresh highlight attrs before message output #25737
Problem:
When MsgArea highlight is changed, the next message may flash
and disappear because msg_start() renders with stale highlight attributes.

msg_puts_len() uses HL_ATTR(HLF_MSG) to render message text, which
happens before update_screen() calls highlight_changed().
So the message is rendered with outdated attrs.

Solution:
Call highlight_changed() in msg_start().
2026-02-17 07:59:07 -05:00
Justin M. Keyes
73c4472d4a Merge #37913 prompt-bufffer, u_savecommon 2026-02-17 07:40:19 -05:00
zeertzjq
4f6b3e5c15 fix(terminal): spurious buffer update with empty buf (#37920)
Problem:  Opening a terminal on an empty buffer produces a spurious
          buffer update event.
Solution: Don't call deleted_lines_buf() if no lines have been deleted.
2026-02-17 20:30:34 +08:00
glepnir
444c195edb fix(highlight): blend underline check and use struct key for attr cache
Problem: hl_blend_attrs() through-blend path only checked HL_UNDERLINE | HL_UNDERCURL
for sp_color blending, missing underdotted, combine/blend attr cache used (a << 16) + b
as map key which could overflow if attr IDs ever exceed 16 bits.

Solution: Use HL_UNDERLINE_MASK in the through-blend path to match all underline
styles. Use uint64_t with (a << 32) | b as map key via HlAttrKey macro so each
attr ID gets its full 32-bit range. Use HLATTRS_INIT in hl_get_underline() to
avoid duplicating default field values.
2026-02-17 18:55:39 +08:00
Sean Dewar
ce9dbd398b fix(undo): u_savecommon uses wrong buffer
Problem: u_savecommon with reload = true wrongly uses curbuf.

Solution: use buf. Fix comments.
2026-02-17 01:03:58 +00:00
Sean Dewar
16bf7652b7 fix(prompt): prompt_setprompt with unloaded buffer, ': with lnum 0
Problem: prompt_setprompt memory leak/other issues when fixing prompt line for
unloaded buffer, or when ': line number is zero.

Solution: don't fix prompt line for unloaded buffer. Clamp ': lnum above zero.
2026-02-17 00:31:26 +00:00
Tristan Knight
13cf80deef fix(lsp): map all LSP methods to server capabilities (#37910) 2026-02-16 13:20:34 -08:00
luukvbaal
49c19a1fe3 fix(messages): message not flushed at end of command #37904
Problem:  Logic determining messages belonging to the last command to
          show with "g<" does not flush pending messages. This can
          result in clearing the temporary message history before a
          message still belonging to the previous command was emitted.
Solution: Flush pending messages when marking the end of messages
          belonging to previous command.
2026-02-16 11:51:43 -05:00
Jibril
501a21f333 fix(coverity/637363): out-of-bounds write #37878
Problem:
stack->offset value is used as an array index.

Solution:
Instead of comparing the stack->offset value to the size in bytes of the array,
compare the actual length of the array.
2026-02-16 09:51:00 -05:00
Justin M. Keyes
f4e88cfe42 Merge #37875 prompt-buffer fixes 2026-02-16 09:37:36 -05:00
luukvbaal
a393347673 fix(extmark): adjust invalidate range by one for deleted lines #37897
Problem:  A multi-line extmark that ends exactly at a deleted range end
          is not invalidated.
          Revalidated sign mark is added with incorrect range.
Solution: Remove questionable invalidation range condition which was
          originally added to avoid deleting a mark that ends below a
          deleted line.

          Since splicing for a deleted line, and a replaced range that
          explicitly ends at column 0 beyond a deleted line is identical,
          we can't try to distinguish these two cases. I.e. :1delete 1
          and nvim_buf_set_text(0, 0, 0, 1, 0, {}) yield the same splice
          operation.

          This means that a multi-line sign_text mark should now span at
          least one column beyond its end_row, as seen in the adjusted
          test. This is still somewhat unexpected/inconvenient to me
          which is what prompted me to try to avoid it with the original
          condition.

          Add revalidated sign mark back to decor with correct range;
          third sign mark added to test exposed a crash.
2026-02-16 09:35:53 -05:00
luukvbaal
d131d67e67 fix(float): clamp floating window above cmdline #37899
Problem:  A float whose zindex is below the cmdline can be enlarged and
          end up behind the cmdline.
Solution: Clamp height of such windows to not extend beyond 'cmdheight'.
2026-02-16 09:33:32 -05:00
Rahul Yedida
249f305bbc feat(defaults): per-platform 'guifont' default #37175
Problem:
Font rendering and kerning are subpar in GUIs.

Solution:
Set default 'guifont' based on common CSS fonts per:
https://github.com/system-fonts/modern-font-stacks#monospace-code
2026-02-16 09:05:23 -05:00
zeertzjq
e6fae64454 fix(terminal): handle opening terminal on unloaded buffer (#37894)
Problem:  Strange behavior when opening terminal on unloaded buffer.
Solution: For nvim_open_term() ensure the buffer is loaded as it needs
          to be read into the terminal. For jobstart() just open the
          memfile as the file content isn't needed.

Not going to make nvim_open_term() pass stdin to the terminal when stdin
isn't read into a buffer yet, as other APIs don't read stdin on unloaded
buffer either. There are also other problems with loading buffer before
reading stdin, so it's better to address those in another PR.
2026-02-16 21:47:45 +08:00
zeertzjq
4450a45466 vim-patch:9.1.1954: Setting a byte in a blob, accepts values outside 0-255
Problem:  Setting a byte in a blob, accepts values outside 0-255
Solution: When setting a byte in a blob, check for valid values
          (Yegappan Lakshmanan)

closes: vim/vim#18870

f4a299700e

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2026-02-16 21:17:02 +08:00
zeertzjq
cbec4603a0 vim-patch:partial:9.1.1668: items() does not work for Blobs
Problem:  items() does not work for Blobs
Solution: Extend items() to support Blob
          (Yegappan Lakshmanan).

closes: vim/vim#18080

da34f84847

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2026-02-16 21:17:02 +08:00
zeertzjq
992543c361 vim-patch:8.2.3841: Vim9: outdated TODO items, disabled tests that work (#37900)
Problem:    Vim9: outdated TODO items, disabled tests that work.
Solution:   Remove TODO items, run tests that work now.  Check that a dict
            item isn't locked.

71b7685092

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-02-16 12:32:18 +00:00
zeertzjq
b51fc202ce vim-patch:3de7384: runtime(doc): Fix :help complete() example (#37891)
closes: vim/vim#18417

3de73844af

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-02-16 14:31:51 +08:00
zeertzjq
b59eba3ada vim-patch:9.2.0007: cindent: recognizing labels within commented lines
Problem:  Comment lines which start like a label are recognized as a
          label and indented based on that.
Solution: Check if the position is in a comment after recognizing a label
          in cin_islabel (Anttoni Erkkilä)

closes: vim/vim#19397

9af18686c7

Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
2026-02-16 08:23:18 +08:00
Sean Dewar
51dc752e6c fix(prompt): wrong changed lnum in init_prompt
Problem: if init_prompt replaces the prompt line at the ': mark, it calls
inserted_bytes with the wrong lnum.

Solution: use the correct lnum. Call appended_lines_mark instead when appending
the prompt at the end.
2026-02-15 23:42:10 +00:00
Sean Dewar
3a10405214 fix(prompt): prompt_setprompt does not adjust extmarks, no on_bytes
Problem: prompt_setprompt does not adjust extmarks or trigger on_bytes
buffer-updates when fixing the prompt line.

Solution: adjust them, trigger on_bytes.

Notably, hides extmarks when replacing the entire line (and clearing user
input). Otherwise, when just replacing the prompt text, hides extmarks there,
but moves those after (in the user input area) to the correct spot.
2026-02-15 23:42:10 +00:00
Sean Dewar
7641177c5f fix(prompt): wrong cursor col after prompt_setprompt, no on_lines
Problem: prompt_setprompt calls coladvance with a byte column, but it expects a
screen column. on_lines buffer-updates aren't fired when fixing the prompt line.

Solution: don't use coladvance. Call changed_lines, which also simplifies the
redraw logic. (and calls changed_cline_bef_curs if needed; added test checks
this)

Unlike https://github.com/neovim/neovim/pull/37743/changes#r2775398744, this
means &modified is set by prompt_setprompt if it fixes the prompt line.
Not setting &modified is inconsistent anyway -- even init_prompt sets it if it
fixes the prompt line.
2026-02-15 23:41:32 +00:00
zeertzjq
7d8653575f vim-patch:9.2.0004: Changing hidden prompt buffer cancels :startinsert/:stopinsert (#37881)
Problem:  Changing hidden prompt buffer cancels :startinsert/:stopinsert
          (after 9.0.1439).
Solution: Don't change mode for a prompt buffer in an autocommand
          window (zeertzjq).

closes: vim/vim#19410

8b81a6b6e1
2026-02-15 22:51:03 +00:00
Riley Bruins
4719b94443 feat(statusline): option to specify stacking highlight groups #37153
**Problem:** No easy way to stack highlight groups #35806.

**Solution:** Add a way to specify a new statusline chunk with a
highlight group that inherits from previous highlight attributes.

Also applies to tabline, etc.
2026-02-15 12:16:51 -05:00
zeertzjq
b614c15392 refactor(terminal): don't put cursor at bottom-left in Normal mode (#37873)
When the terminal process is suspended, putting cursor at bottom-left
hints that pressing a key will change the suspended state. However, when
returning to Normal mode, the user is more likely to interact with the
actual terminal output (e.g. copying it), so it's better to put cursor
at the old position which should be closer to the output.

Also, using is_focused() to check for mode is confusing. Just check
`State & MODE_TERMINAL` instead.
2026-02-15 17:25:22 +08:00
Sean Dewar
2a5d687cc9 fix(prompt): prompt_setprompt sets cursor col unnecessarily
Problem: prompt_setprompt adjusts the cursor's column number even when it's not
on the prompt's line.

Solution: only adjust when on the prompt's line.
2026-02-15 06:04:12 +00:00
Sean Dewar
b3096b5860 fix(prompt): ml_get error with invalid ': lnum
Problem: internal error E315 in init_prompt if ': has an invalid line number.

Solution: clamp the line number.
2026-02-15 01:41:12 +00:00
Sean Dewar
4afbc25432 fix(prompt): heap-buffer-overflows with invalid ': col
Problem: heap-buffer-overflow in init_prompt and prompt_setprompt if ': mark has
an invalid column number.

Solution: consider an out-of-bounds column number as a missing prompt.

Remove the check for NULL for old_line, as ml_get_buf can't return NULL.
2026-02-15 01:41:12 +00:00
Sean Dewar
1349233cd1 fix(prompt): heap-buffer-overflow in prompt_setprompt
Problem: prompt_setprompt may check the wrong buffer, which can lead to a
heap-buffer-overflow.

Solution: don't use curbuf.

Also replace all kCallbackNone initializers with CALLBACK_INIT.
2026-02-15 01:40:31 +00:00
zeertzjq
f8d59cfab9 fix(highlight): setting 'winhl' doesn't work with global ns (#37868)
Problem:  Setting 'winhighlight' doesn't after setting global namespace
          using nvim_win_set_hl_ns().
Solution: Check if using another namespace when setting 'winhighlight'
          instead of disabling 'winhighlight' in nvim_win_set_hl_ns().
2026-02-15 08:03:44 +08:00
Shadman
8ab511bba5 feat(prompt): plugins can update prompt during user input #37743
Problem:
Currently, if prompt gets changed during user-input with
prompt_setprompt() it only gets reflected in next prompt. And that
behavior is not also consistent. If user re-enters insert mode then the
user input gets discarded and a new prompt gets created with the new
prompt.

Solution:
Handle prompt_setprompt eagerly. Update the prompt display, preserve user input.
2026-02-14 12:18:08 -05:00
Tristan Knight
b99cdd08de refactor(lsp): centralize provider capability resolution #37221
- Refactor LSP client to use unified provider-based capability lookup for
  diagnostics and other features.
- Introduce `_provider_value_get` to abstract capability retrieval,
  supporting both static and dynamic registrations.
- Update diagnostic handling and protocol mappings to leverage
  provider-centric logic.
2026-02-14 10:50:48 -05:00