Commit Graph

9412 Commits

Author SHA1 Message Date
Yochem van Rosmalen
9bdb011a50 refactor(spellfile): config() interface, docs #36481
Problem:
- Exposing the raw config as table is a pattern not seen anywhere else
  in the Nvim codebase.
- Old spellfile.vim docs still available, no new documentation

Solution:
- Exposing a `config()` function that both acts as "getter" and "setter"
  is a much more common idiom (e.g. vim.lsp, vim.diagnostic).
- Add new documentation and link old docs to |spellfile.lua| instead of
  |spellfile.vim|.
2025-11-09 21:51:39 -08:00
Riley Bruins
c2c5a0297e fix(lsp): don't overlay insertion-style inline completions (#36477)
* feat(lua): `Range:is_empty()` to check vim.range emptiness

* fix(lsp): don't overlay insertion-style inline completions

**Problem:** Some servers commonly respond with an empty inline
completion range which acts as a position where text should be inserted.
However, the inline completion module assumes that all responses with a
range are deletions + insertions that thus require an `overlay` display
style. This causes an incorrect preview, because the virtual text should
have the `inline` display style (to reflect that this is purely an
insertion).

**Solution:** Only use `overlay` for non-empty replacement ranges.
2025-11-09 17:49:25 -08:00
glepnir
76fdd9b882 fix(pum): crash when resizing grid with pumborder set (#36404)
Problem: Grid size check didn't account for border_width, causing
row index out of bounds when drawing bordered popup menu.

Solution: Check grid.rows against pum_height + border_width.
2025-11-10 07:07:25 +08:00
luukvbaal
8d6963a6a0 fix(ui): cmdline_show is not fired after clearing the screen (#36451)
Problem:  Resize events during startup may clear an active external
          cmdline, which is then not redrawn.
          UI2 VimResized autocommand does not work.
          UI2 message appearance may be altered by inherited window
          options. The message separator uses the wrong fillchar.

Solution: Unset cmdline_was_last_redrawn when clearing the screen, such
          that cmdline_show is re-emitted.
          Ensure set_pos function is called without arguments.
          Ensure such options are unset. Use 'fillchars'->msgsep.
2025-11-08 11:38:56 +01:00
Shadman
466b2ac192 fix(prompt): wrong cursor position with cursor keys (#36196)
**Problem**:
Currently, whenever user get's on prompt-text area we move the user to
end of user-input area. As a result when left/c-left,home keys are
triggered at start of user-input the cursor get's placed at end of
user-input. But this behavior can be jarring and unintuitive also it's
different from previous behavior where it'd just stay at start of
input-area. Also, previously when insert-mode was triggered in
prompt-text with n_a for example then cursor was placed at start of
user-input area not at the end. So, that behavior was also broken.

**Solution:**
Restore previous behavior. Don't force user to end of user-input when
entering insert-mode from readonly section.
2025-11-08 10:40:37 +08:00
zeertzjq
003b429a86 vim-patch:9.1.1892: Not possible to know once Vim is done with sourcing vimrc (#36429)
Problem:   A plugin does not know when startup scripts were already
           triggered. This is useful to determine if a function is
           called inside vimrc or after (like when sourcing 'plugin/'
           files).
Solution:  Add the v:vim_did_init variable (Evgeni Chasnovski)

closes: vim/vim#18668

294bce21ee

Nvim has two more steps between sourcing startup scripts and loading
plugins. Set this variable after these two steps.

Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2025-11-02 18:07:33 +08:00
zeertzjq
d847548a1c vim-patch:9.1.1893: ICCF charity will dissolve (#36427)
Problem:  ICCF charity will dissolve
Solution: Update references to Kuwasha

Since the ICCF[1] will be dissolved and handing over to the Kuwasha charity
to continue supporting the Kibaale Children Center in Uganda, update the
uganda.txt help file.

[1]: https://groups.google.com/g/vim_announce/c/pUNbNXBLbKw/m/-zFUd4JjAQAJ

fixes: vim/vim#18584
closes: vim/vim#18667

0405665638

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-11-02 08:29:00 +08:00
varsidry
b92b95e2c2 vim-patch:9.1.1891: g<End> does not move to last non-blank in visual mode (#36354)
Problem:  In visual mode, g<End> does not move to the last non-blank
          character when the end of a line is on the same line as the
          cursor (after v9.0.1753)
Solution: Move the cursor back by one position if it lands after the
          line (varsidry)

fixes: vim/vim#18657
closes: vim/vim#18658

adc85151f3
2025-11-01 01:37:12 +00:00
zeertzjq
d077a24f5c fix(socket): avoid stack-use-after-return after timeout (#36405)
Problem:
In socket_connect(), if connecting to the given TCP address times out,
libuv is still trying to connect to the address, and connect_cb may be
called when running the libuv event loop after the `status` variable
referenced by `req.data` goes out of scope.

Solution:
Close the uv_tcp_t handle and wait for connect_cb to be called before
retrying or failing in socket_connect(). This also avoid leaking libuv
handles.

The tests added here only check that the non-timeout case still works,
as checking the timeout case is very hard without modifications to the
code. Removing the first LOOP_PROCESS_EVENT_UNTIL() in socket_connect()
(the one with the timeout) is a way to check that manually.

Also add a comment about the cause of the ASAN error in #34586.
2025-11-01 08:20:46 +08:00
zeertzjq
1fddd74da7 vim-patch:9.1.1889: filetype: not all AppleScript files are recognized (#36411)
Problem:  filetype: not all AppleScript files are recognized
Solution: Detect *.applescript files as applescript filetype
          (Samuel Huang)

Reference:
https://en.wikipedia.org/wiki/AppleScript

closes: vim/vim#18672

69dd5906fd

Co-authored-by: Samuel Huang <hi@sgh.ng>
2025-11-01 06:27:11 +08:00
11soda11
b258382176 fix(completion): complete drive-letter filepath on Windows #36353
Problem:
On MSWIN, file completion (CTRL-X CTRL-F) only works for the current
drive (so not for actual absolute paths), since drive letters are never
included in the completion pattern.

e.g. when completing "F:\Hello" Nvim currently completes "\Hello"
which is relative to the current drive/volume.

vim solves this by adding ':' to the default 'isfname' value on mswin,
but that causes issues as ':' is not a valid windows path char anywhere
_except_ after the drive letter.

Solution:
detect drive letters in front of the path when creating the completion
pattern.
2025-10-31 12:33:01 -07:00
zeertzjq
2b83237b0f test(api/server_requests_spec): fix flaky test (#36410)
Wait for the notification to be processed.
2025-10-31 14:06:11 +00:00
zeertzjq
d4106bade7 vim-patch:9.1.1890: %P in 'statusline' doesn't behave as documented
Problem:  %P in 'statusline' doesn't behave as documented
          (after 9.1.1479).
Solution: Make the percentage 3-chars wide when not translated.
          (zeertzjq)

fixes: vim/vim#18669
closes: vim/vim#18671

73a0de4a04

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2025-10-31 18:46:01 +08:00
zeertzjq
a0f3fdba58 vim-patch:9.1.1479: regression when displaying localized percentage position
Problem:  regression when displaying localized percentage position
          (after v9.1.1291)
Solution: calculate percentage first (Emir SARI)

Cleanups made in ec032de broke the Turkish percent display, failing to
prepend it properly in cases between 0 and 10. In Turkish, the percent
sign is prepended to the number, so it was displaying it as `% 5`
(should have been `%5`), while displaying numbers bigger than 9 properly.

related: vim/vim#17597

8fe9e55a7d

The test was unskipped in Vim in patch 9.1.1479 which added Turkish
translation for "%d%%". However, Nvim has had Turkish translation for
"%d%%" since 2023, so don't skip the test.

Co-authored-by: Emir SARI <emir_sari@icloud.com>
2025-10-31 18:46:01 +08:00
bfredl
d825e51169 Merge pull request #36381 from bfredl/nobilium
feat(build): HAVE_UNIBILIUM
2025-10-31 10:17:02 +01:00
bfredl
e1ffa8d33b feat(build): HAVE_UNIBILIUM
compile time features are hot again.

Note: this changes the &term value for builtin definition from
'builtin_xterm' to just 'xterm'. It's an xterm regardless of we use an
external definition or an internal. Prior to this commit the vast
majority of POSIX users will have used external terminfo, so plugins and
scripts are only going to have checked for &term == 'xterm' or 'tmux' or
whatever.
The status of external loading is still available in "nvim -V3" output.
2025-10-31 08:39:32 +01:00
zeertzjq
accd392f4d Merge pull request #36393 from zeertzjq/rstream-close-cb
fix(channel): closing socket with pending writes leaks memory
2025-10-31 09:14:19 +08:00
zeertzjq
ce9a73625a test(tui_spec): check logfile for --listen error (#36390) 2025-10-30 09:06:30 +00:00
zeertzjq
e87f2d1cf9 test(tui_spec): separate remote client :restart tests (#36388)
:restart changes the terminal under which the server process is run,
which can be confusing when combined with other testing.

Also, use COLORTERM=xterm-256color for tests with 'notermguicolors' to
avoid delay on server exit. Not all these delays are blocking, but they
increase the number of simultaneously existing Nvim processes.
2025-10-30 16:23:22 +08:00
zeertzjq
50a38d9698 fix(tui): heap-use-after-free when resuming (#36387)
Discovered when writing more tests for suspend/resume.
It seems that this isn't always reproducible with ASAN due to the arena.
2025-10-30 05:26:49 +00:00
zeertzjq
69bddc089f fix(tui): don't call tinput_init() twice (#36386) 2025-10-30 03:06:30 +00:00
zeertzjq
c75f547839 vim-patch:9.1.1888: Wrong display with cpo+=$, matchparen and wrapped line (#36385)
Problem:  Wrong display with cpo+=$, matchparen and wrapped line.
Solution: Use old cursor line height when scrolling with cpo+=$. Also
          fix wrong redraw in non-current window. (zeertzjq)

fixes: vim/vim#18647
closes: vim/vim#18662

5c3e762631
2025-10-30 07:29:21 +08:00
bfredl
4b678a499c refactor(termkey): make termkey use internal terminfo properly
problem: termkey/driver-ti.c had its internal dependency upon unibilium
which would completely skip builtin terminfo defs.
solution: add termkey info to TerminfoEntry struct

NOTE: this disables a lot of named function keys which are present as
terminfo "keys" both are mostly unset in terminfo entries for modern
terminals, and also  not recognized by nvim as mappable keys
anyway, except a few ones like `<undo>` which this still will keep.

We probably don't want to encode up to F63 keys forever. While only 12
physical keys are available on modern keybords, instead Chords using
F-keys are usually encoded as high key numbers, like <C-S-F3>
becoming <F39> . But reconsideirg that has implications for configuration
that is best done as a separate (breaking) change.
2025-10-29 09:43:36 +01:00
zeertzjq
4ef7aa83c4 fix(terminal): keep last cursor if it's on the last row 2025-10-29 10:18:01 +08:00
zeertzjq
3fb56ff8af vim-patch:9.1.1885: Wrong restored cursor pos when re-entering buffer after changes
Problem:  Wrong restored cursor position when re-entering a buffer
          previously viewed in a window after making changes to the same
          buffer in another window.
Solution: Adjust per-window "last cursor" positions on buffer changes.
          (zeertzjq)

closes: vim/vim#18655

b2e6b328da
2025-10-29 10:18:01 +08:00
Jonny Kong
e2cb675705 fix(filetype): move fallback logic to vim.filetype.match() #30141
Problem:
Previously, the fallback logic to ".conf" was located outside of
`vim.filetype.match()` and directly within the AutoCmd definition. As a
result, `vim.filetype.match()` would return nil instead of ".conf" for
fallback cases (#30100).

Solution:
Added a boolean return value to `vim.filetype.match()` that indicates
whether the match was the result of fallback. If true, the filetype will
be set using `setf FALLBACK <ft>` instead of `setf <ft>`.
2025-10-28 18:45:50 -07:00
zeertzjq
3c14646896 vim-patch:9.1.1886: filetype: Android aconfig files are not recognized (#36374)
Problem:  filetype: Android aconfig files are not recognized
Solution: Detect *.aconfig files as pbtxt filetype (Bruno Belanyi)

Reference:
https://source.android.com/docs/setup/build/feature-flagging/declare-flag

closes: vim/vim#18656

7adeb09bb2

Co-authored-by: Bruno Belanyi <bruno@belanyi.fr>
2025-10-29 00:16:15 +00:00
zeertzjq
c2781d3db3 vim-patch:9.1.1883: Wrong display with 'smoothscroll' with -diff (#36372)
Problem:  Wrong display with 'smoothscroll' when FEAT_DIFF is disabled.
Solution: Use plines_correct_topline() (zeertzjq).

closes: vim/vim#18649

e06e70f7b1
2025-10-28 23:49:53 +00:00
zeertzjq
21ea0537e0 vim-patch:9.1.1880: Allocation error with complete_info() (#36360)
Problem:  Allocation error with complete_info()
          (after v9.1.1876)
Solution: Make sure length is positive (kuuote)

closes: vim/vim#18640

7d3b647f88

Co-authored-by: kuuote <znmxodq1@gmail.com>
2025-10-28 07:13:58 +08:00
Eduardo Cruz Guedes
5e039c8e97 fix(tutor): remove hyperlinks, simplify non-interactive examples #36307
1. Every hyperlink-like element was replaced by `"$1"` (where $1 is the original string showed in the hyperlink);
2. Arrows `--->` were used in lines containing practice examples when no editing text is involved;
3. Context on interactivity was minimally adapted when strictly needed, not to disrupt the original tutor's intent;
4. Tests regarding the tutor file refactored to ensure the new syntax is not flagged as an error.
2025-10-27 10:24:00 -07:00
yilisharcs
b9451dfd4c fix(ui2): emit FileType event after setting default pager options #36315
Problem: Setting a filetype before configuring default options for ui2
buffers (pager, cmd, ...) prevents users from setting their own options.

Solution: Call nvim_set_option_value after defaults are set.

Closes #36314

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2025-10-27 10:19:16 -07:00
tao
a768d0a95b fix(lsp): stop repeatedly resuming dead coroutine #35743
Problem:
Error extracting content-length causes all future coroutine resumes to
fail.

Solution:
Replace coroutine.wrap with coroutine.create in create_read_loop
so that we can check its status and catch any errors, allowing us to
stop the lsp client and avoid repeatedly resuming the dead coroutine.
2025-10-27 10:03:45 -07:00
zeertzjq
070f4d3da0 vim-patch:9.1.1875: username parsing bug in netrw plugin (#36348)
Problem:  username parsing bug in netrw plugin when using remote adding
          feature
Solution: Allow any characters except for "@" (Václav Kobera), add a
          test for the netrw plugin

closes: vim/vim#18611

f17f78c557

Co-authored-by: Václav Kobera <vasekobera@gmail.com>
2025-10-27 03:20:34 +00:00
zeertzjq
db35dd6734 test(ex_terminal_spec): fix flakiness (#36347) 2025-10-27 02:54:14 +00:00
zeertzjq
35d04394aa vim-patch:9.1.1878: filetype: Soy files are not recognized (#36346)
Problem:  filetype: Soy files are not recognized
Solution: Detect *.soy files as soy filetype,
          include a soy filetype plugin (Riley Bruins)

closes: vim/vim#18640

9fff99c3c2

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-10-27 02:52:56 +00:00
zeertzjq
155efabb15 vim-patch:9.1.1876: pre-inserted text not exposed in complete_info() (#36342)
Problem:  pre-inserted text not exposed in complete_info()
Solution: Add the pre-inserted text to the complete_info() Vim script
          function (Girish Palya)

closes: vim/vim#18571

Feat: expose preinserted text in complete_info()

ef5bf58d8c

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-10-27 01:34:52 +00:00
zeertzjq
fb6fd17f26 vim-patch:9.1.1870: :Tutor may not work as expected (#36343)
Problem:  :Tutor may not work as expected
Solution: set buftype=nowrite instead of nofile
          (Phạm Bình An)

closes: vim/vim#18613

9978bb77c6

Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
2025-10-27 01:21:52 +00:00
zeertzjq
f0cf488698 vim-patch:9.1.1877: cindent: wrong indentation after an array declaration (#36340)
Problem:  cindent: wrong indentation after an array declaration
Solution: check if the filetype if javascript before matching the syntax
          (Anttoni Erkkilä)

cindent matches a javascript syntax for C files causing wrong
indentation in the following case:
```
void foo() {
float a[5],
b;
}
```

closes: vim/vim#18631

61ef8a3db9

Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
2025-10-27 00:06:25 +00:00
zeertzjq
d707ccf988 fix(api): inconsistent scrolling when deleting before topline (#36301)
Problem:  Inconsistent scrolling when deleting before topline with API.
Solution: Only special-case inserting just before topline, not deleting.
2025-10-27 07:53:15 +08:00
zeertzjq
2407833ba1 vim-patch:9.1.1872: Cmdline history not updated when mapping <Up> and <CR> (#36334)
Problem:  Cmdline history not updated when mapping both <Up> and <CR>.
Solution: Consider the command typed when in Cmdline mode and there is
          no pending input (zeertzjq).

Although the existing behavior technically does match documentation, the
"completely come from mappings" part is a bit ambiguous, because one may
argue that the command doesn't completely come from mappings as long as
the user has typed a key in Cmdline mode.  I'm not entirely sure if this
change will cause problems, but it seems unlikely.

fixes: vim/vim#2771
related: neovim/neovim#36256
closes: vim/vim#18607

97b6e8b424
2025-10-26 22:19:32 +08:00
Justin M. Keyes
07461bac27 Merge #34940 refactor(spell): migrate to Lua, drop netrw dep 2025-10-25 20:08:02 -04:00
Justin M. Keyes
4d501c93bb refactor(spell): cleanup
- prefer `stdpath(data)/site/spell` instead of looking for random dirs in 'runtimepath'.
- drop unused functions `choose_directory`, `setup`, etc.
2025-10-26 01:28:37 +02:00
Tom Ampuero
7c5ff99e8a refactor(spell): migrate to Lua, drop netrw dependency
Problem:
Spell file downloads relied on Vimscript and netrw (:Nread). If netrw is
disabled, downloads fail.

Solution:
Port the logic to Lua as `nvim.spellfile` and wire it via a Lua plugin that
handles `SpellFileMissing`. Use `vim.net.request()` with a timeout for HTTP,
prompt via `vim.fn.input` and report via `vim.notify`.

Closes #7189
2025-10-26 00:33:41 +02:00
zeertzjq
df23952ce9 fix(tui): don't treat remote TUI as GUI (#36319)
Set "stdin_tty" and "stdout_tty" UI options, so that a remote TUI is not
treated as a GUI.
2025-10-26 06:18:13 +08:00
zeertzjq
5db3544991 vim-patch:9.1.1871: Wrong 'showcmd' in the cmdwin (#36320)
Problem:  Wrong 'showcmd' in the command-line window.
Solution: Clear 'showcmd' when entering cmdwin (zeertzjq).

related: neovim/neovim#36271
closes: vim/vim#18616

826326f13b
2025-10-25 22:16:05 +08:00
Justin M. Keyes
fe4faaf81a docs: dev-quickstart, dev-test #36304 2025-10-24 17:24:51 -07:00
zeertzjq
737dd83d1f vim-patch:9.1.1869: tests: test failures with Python 3.14 and test_python3 (#36310)
Problem:  tests: test failures with Python 3.14 and test_python3
Solution: Adjust the expected error message (Yee Cheng Chin)

Python 3.14 changed the error message from "argument must be 2-item
sequence" to "argument must be 2-item tuple". Fix test to account for
that. Otherwise the error message for the `vim.current.window.cursor =
True` line would not match.

closes: vim/vim#18629

6cb995970e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-10-25 08:02:41 +08:00
zeertzjq
520568f40f fix(terminal): adjust marks when deleting scrollback lines (#36294)
This also fixes inconsistent scrolling behavior on terminal output when
cursor is in the middle of the buffer and the scrollback is full.
2025-10-25 06:48:04 +08:00
luukvbaal
d909de2dc2 fix(ui): ignore textlock for vim.ui_attach() callbacks #36278
Problem:  vim.ui_attach() callbacks may run into E565 textlock errors.
Solution: Changing text in UI buffers must be safe; assume it is.
2025-10-24 14:40:21 -07:00
xvzc
095b9f98f3 fix(filetype): handle invalid bufnr in _getlines(), _getline() #36272
**Problem:**
`vim.filetype.match({ filename = 'a.sh' })` returns `nil` because
an invalid buffer ID is passed to `vim.api.nvim_buf_get_lines()`.
For filetypes like `csh`, `txt`, or any other extensions that call
`_getlines()` or `_getline()` to detect their filetypes, the same
issue occurs.

When only the `filename` argument is passed, an error is raised
inside a `pcall()` that wraps the filetype detection function,
causing it to return no value without showing any error message.

**Solution:**
Validate the `bufnr` value in `_getlines()` and `_getline()`.
2025-10-23 17:34:12 -07:00