8966 Commits

Author SHA1 Message Date
e56292071a fix(terminal): check size when switching buffers
Problem: terminal not always resized when switching to its buffer.
Solution: add missing calls to terminal_check_size.
2025-05-09 17:49:57 +01:00
6adf48b66d fix(decor): extmark highlight not applied (#33858)
Problem: If the only highlight present in the buffer is an extmark, and its end
position is outside the screen, redraws that start on lines after the
first line of the mark will consider the buffer as not having any highlights,
and skip drawing the mark's highlight.
Solution: Check the updated number of decor ranges.
2025-05-09 12:37:43 +02:00
7e787f6a4f fix(extui): route interactive messages to more-window (#33885)
Problem:  Extui does not route messages emitted as a result of a typed
          command to the "more" window.
          Command message leading shell messages is missing a kind.
          Messages not routed to 'cmdheight' area after it was 0.
Solution: Route messages that were emitted in the same event loop as an
          entered command to the "more" window. Also append multiple
          messages in an already open more-window.
          Assign it the `shell_cmd` kind.
          Change message position when 'cmdheight' changes from 0.
2025-05-09 12:17:26 +02:00
15d31fe7a6 vim-patch:9.1.1374: completion: 'smartcase' not respected when filtering matches
Problem:  Currently, 'smartcase' is respected when completing keywords
          using <C-N>, <C-P>, <C-X><C-N>, and <C-X><C-P>. However, when
          a user continues typing and the completion menu is filtered
          using cached matches, 'smartcase' is not applied. This leads
          to poor-quality or irrelevant completion suggestions, as shown
          in the example below.
Solution: When filtering cached completion items after typing additional
          characters, apply case-sensitive comparison if 'smartcase' is
          enabled and the typed pattern includes uppercase characters.
          This ensures consistent and expected completion behavior.
          (Girish Palya)

closes: vim/vim#17271

dc314053e1

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-05-09 06:48:18 +08:00
50c200fcd4 Merge pull request #33850 from MariaSolOs/on-jump
feat(diagnostic): add `on_jump` callback option
2025-05-08 11:42:24 -05:00
7c43f8e433 fix(messages): messages added to history missing from ext_messages "g<" #33907
Problem:  Messages that are already added to the history are not emitted
          as part of the "g<" msg_history_show event.

Solution: Move clearing the history for temporary messages to before
          adding a message to the history, rather than after emitting
          a message.
2025-05-08 05:50:25 -07:00
1b8ae4336d test(swapfile): don't check for line with full file path (#33896)
Wrapping can happen anywhere where in the full file path, breaking the
matching. Match a line with the "Xswaptest" line instead.
2025-05-08 07:51:23 +08:00
2aa7948266 fix(treesitter): invalidate conceal_lines cache earlier #33875
Problem:  conceal_lines cache is invalidated in `on_buf`
          which is too late for code calculating text height after a
          buffer change but before a redraw (like `lsp/util.lua`).

Solution: Replace `on_buf` with `on_bytes` handler that invalidates
          the cache and clears the marks.
2025-05-06 18:03:54 -07:00
f5b5f2095e refactor(tests): lint decorations_spec, float_spec, multigrid_spec #33274
Problem:
decorations_spec.lua, float_spec.lua, multigrid_spec.lua are not
auto-formatted.

Solution:
Add a special `formatlua2` cmake target, which invokes `stylua` with
an alternative `.stylua2.toml` config.
2025-05-06 18:00:20 -07:00
db2b774a16 fix(runtime): 'includeexpr' with non-Nvim-style Lua modules #33867
Closes #33862
2025-05-06 05:15:31 -07:00
c65817774d feat(diagnostic): add on_jump callback option 2025-05-05 19:59:22 -07:00
1e7406fa38 feat(api): nvim_cmd supports plus ("+cmd", "++opt") flags #30103
Problem:
nvim_cmd does not handle plus flags.

Solution:
In nvim_cmd, parse the flags and set the relevant `ea` fields.
2025-05-05 05:58:36 -07:00
912388f517 fix(messages): list_cmd kind for buffer line messages (#33855)
Problem:  Missing kind and separate event for each line for message
          containing buffer lines for e.g. `:print`.
Solution: Set the `list_cmd` kind and only `msg_start()` for the first
          message, print a newline instead.
2025-05-05 12:04:09 +00:00
40351bbbbe fix(lua): vim.validate message param #33675
Problem:
vim.validate does not handle `message` param.

Solution:
Add the missing logic.
2025-05-04 16:36:32 -07:00
0862c1036a fix(lsp): check if client is stopping before reuse #33796
Problem:
Stopping a language server and then calling vim.lsp.start() with the same name/root will return the old language server that's in the middle of shutting down. vim.lsp.start() won't return a new server until the old process has terminated.

Solution:
Introducing a client._is_stopping field that tracks the shutdown phase, preventing the client from being reused.
2025-05-04 14:38:01 -07:00
df345503eb refactor(lua): swap value params in tbl_extend behavior callback #33847 2025-05-04 14:28:03 -07:00
fc2dee1736 feat(messages): cleanup Lua error messages
"Error" in error messages is redundant. Just provide the context, don't
say "Error ...".
2025-05-04 11:22:57 -04:00
af4f7f1618 test: multiline assert_log()
Problem:
assert_log() only matches single lines. This was never an intentional
decision, it was merely a result of using read_file_list().

Note: any tests that indiscriminately match `.*` should be rewritten to
avoid (unlikely) "false positives". I checked all existing tests.

Solution:
Change assert_log() to match the concatenated lines instead of matching
per-line.
2025-05-04 10:35:07 -04:00
8f5bd569c5 feat(lsp): support documentColor dynamic registration #33800 2025-05-04 07:00:21 -07:00
627c648252 vim-patch:9.1.1361: [security]: possible use-after-free when closing a buffer (#33820)
Problem:  [security]: Possible to open more windows into a closing
          buffer without splitting, bypassing existing "b_locked_split"
          checks and triggering use-after-free
Solution: Disallow switching to a closing buffer. Editing a closing
          buffer (via ":edit", etc.) was fixed in v9.1.0764, but add an
          error message and check just "b_locked_split", as "b_locked"
          is necessary only when the buffer shouldn't be wiped, and may
          be set for buffers that are in-use but not actually closing.
          (Sean Dewar)

closes: vim/vim#17246

6cb1c82840
2025-05-04 03:15:51 +01:00
b877aa34cf feat(lsp): detach LSP clients when 'filetype' changes #33707
Problem:
When the buffer 'filetype' changes, invalid or non-applicable LSP
clients are not detached.

https://github.com/neovim/neovim/issues/33443
https://github.com/neovim/nvim-lspconfig/issues/3326

Solution:
In the enable() routine, check can_start() on _existing_ clients.
2025-05-03 14:57:59 -07:00
047a10bfde feat(lua): function behavior for tbl_extend, tbl_deep_extend #33819 2025-05-03 14:53:44 -07:00
8305af9bd2 fix(statusline): clear ruler when it is no longer drawn #33765
Problem:  Ruler is not cleared from the screen/ext_messages state when
          it is no longer drawn after e.g. `set noruler` or when moving
          from a floating to a regular window.
Solution: Remember if ruler was drawn and clear it.
2025-05-03 14:24:11 -07:00
6256adde2f fix(quickfix): always split from current window #33807
Problem:  `:copen` opens at the bottom by switching to `lastwin`,
           needlessly changing the window it inherits context from.

Solution:  Use the `WSP_BOT` flag to `win_split()` to open at the bottom.
2025-05-03 13:38:20 -07:00
403fcacfc1 fix(window): skip unfocusable and hidden floats with "{count}<C-W>w" #33810
Problem: Using `<C-W>w`, `<C-W>W` or the ":wincmd" variants with a count can
enter unfocusable or hidden floating windows. This is especially problematic
when using the new in-development extui, which creates many unfocusable floats
for various UI elements.

Solution: Skip unfocusable and hidden floating windows. Instead, skip to the
next focusable, non-hidden window in the current tabpage's window list. Reword
the documentation a bit (hopefully an improvement?)
2025-05-03 11:30:24 -07:00
03d378fda6 feat(lsp): vim.lsp.is_enabled() #33703
Problem:
No way to check if a LSP config is enabled without causing it to
resolve. E.g. `vim.lsp.config['…'] ~= nil` will resolve the config,
which could be an unwanted and somewhat expensive side-effect.

Solution:
Introduce `vim.lsp.is_enabled()`.
2025-05-03 10:25:58 -07:00
5d1fd4aca5 fix(lsp): improper diagnostic end_col computation
**Problem:** For multiline diagnostics, the end column was improperly
calculated by checking the byte index of the character position on the
*start* line.

**Solution:** Calculate the byte index for end_col using the *end* line.
2025-05-03 10:01:20 +02:00
adbd33027f fix(tui): don't try to add unsupported modifiers (#33799)
Problem:  The TUI doesn't forward a key properly when it has unsupported
          modifiers like NumLock.
Solution: Don't try to add modifiers when only unsupported modifiers are
          present.

Related #33791
2025-05-03 12:09:28 +08:00
da3eeb4b32 vim-patch:9.1.1360: filetype: GNU Radio companion files are not recognized
Problem:  filetype: GNU Radio companion files are not recognized
Solution: detect *.grc files as xml or yaml filetype depending on the
          first line (zeertzjq).

Ref:
- https://wiki.gnuradio.org/index.php/XML_GRC
- https://wiki.gnuradio.org/index.php/YAML_GRC

closes: vim/vim#17241

af4a5d6e2a
2025-05-02 21:53:18 +08:00
074a6abd55 vim-patch:9.1.1359: filetype: GNU Radio config files are not recognized
Problem:  filetype: GNU Radio config files are not recognized.
Solution: detect GNU Radio config files as confini filetype.  Only
          allow '#' as start of comment in confini syntax (zeertzjq).

Ref:
- https://wiki.gnuradio.org/index.php/Configuration_Files

closes: vim/vim#17242

9c9200d1ea
2025-05-02 21:53:15 +08:00
0741d2520d feat(messages): hl-StderrMsg, hl-StdoutMsg #33429
Problem:
stderr messages from executing ":!cmd" show up with
highlight hl-ErrorMsg. But some shell utilites use stderr for debug
logging, progress updates, etc.

Solution:
Highlight shell command outputs hl-StderrMsg and hl-StdoutMsg.
2025-05-02 06:06:55 -07:00
4b5364b423 fix(tui): forward C0 control codes literally (#33759)
This fixes the problem that sending a raw C0 control code to trigger a
mapping for it does not work in Terminal mode.

Note: this isn't done for 00 or 7F, as that'll be backward-incompatible.
2025-05-02 17:40:24 +08:00
da401ca25b Merge pull request #28344 from bfredl/wonderland
feat(build): build.zig MVP: build and run functionaltests on linux
2025-05-02 10:34:25 +02:00
1f004970f0 feat(build): build.zig MVP: build and run functionaltests on linux
NEW BUILD SYSTEM!

This is a MVP implementation which supports building the "nvim" binary,
including cross-compilation for some targets.
As an example, you can build a aarch64-macos binary from
an x86-64-linux-gnu host, or vice versa

Add CI target for build.zig currently for functionaltests on linux
x86_64 only

Follow up items:

-  praxis for version and dependency bumping
-  windows 💀
-  full integration of libintl and gettext (or a desicion not to)
-  update help and API metadata files
-  installation into a $PREFIX
-  more tests and linters
2025-05-02 09:28:50 +02:00
65a4c8f3ca vim-patch:9.1.1357: Vim incorrectly escapes tags with "[" in a help buffer
Problem:  Vim incorrectly escapes tags containing "[" in a help buffer
Solution: check if the buffer has the "help" filetype set, instead of
          already being a help buffer (Phạm Bình An)

fixes: vim/vim#17224
closes: vim/vim#17232

6af20a9be3

Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-05-02 07:05:22 +08:00
d567f899ef fix(diagnostic): allow virtual_{lines,text} cursor exclusivity #33517
Problem:
virtual_text diagnostics are great when skimming a file, and
virtual_lines are great when "zooming in" on a particular problem.
Having both enabled results in duplicate diagnostics on-screen.

Solution:
This PR expands the behavior of `current_line` for virtual_text and
virtual_lines by making `virtual_text.current_line = false` distinct
from `nil`.  If you set:

    vim.diagnostic.config({
      virtual_text = { current_line = false },
      virtual_lines = { current_line = true },
    })

With this configuration, virtual_text will be used to display
diagnostics until the cursor reaches the same line, at which point they
will be hidden and virtual_lines will take its place.
2025-05-01 03:54:39 -07:00
97a6259442 fix(display): adjust setting winline info for concealed lines (#33717)
Problem:  Wrong winline info after partial redraw. Setting
          `conceal_cursor_used` is unnecessarily spread out.
Solution: Rather than adjusting `wl_lastlnum` for the previous
          winline, adjust it when setting the current winline.
          Set `conceal_cursor_used` when the current window is redrawn.
2025-05-01 09:51:51 +02:00
4bc7bac884 feat(lsp): start/stop LSPs as necessary during vim.lsp.enable() #33702
Problem:
enable() could be more flexible, so that it works even if called "late".

Solution:
- enable(true) calls `doautoall nvim.lsp.enable FileType`.
- enable(false) calls `client:stop()` on matching clients.

This will be useful for e.g. :LspStop/:LspStart also.
2025-04-30 16:57:29 -07:00
71f3a9c590 feat(terminal): parse current buffer contents in nvim_open_term() (#33720)
When nvim_open_term() is called with a non-empty buffer, the buffer
contents are piped into the PTY.
2025-04-30 21:34:23 +00:00
6577d72d81 feat(lsp): root_markers can control priority #33485
Problem:
root_markers cannot specify "equal priority filenames.

Solution:
Support nesting:

    {
      ...
      root_markers = { { ".stylua.toml", ".luarc.json" }, { ".git "} }
      ...
    }


Co-authored-by: Maria José Solano <majosolano99@gmail.com>
Co-authored-by: Gregory Anders <github@gpanders.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-04-30 06:43:32 -07:00
f27fb737ce Merge pull request #33727 from bfredl/bordergrid
fix(ui): correct condition for "wrap" flag in a floating grid
2025-04-30 13:56:32 +02:00
0015a105ca fix(cmdline): do not move UI cursor when entering cmdline #33729
Problem:  Cursor is still moved to curwin when entering cmdline (after d41b8d47).

Solution: Remove call to `setcursor()`.
2025-04-30 04:51:14 -07:00
272dba7f07 fix(trust): support for trusting directories #33617
Problem:
Directories that are "trusted" by `vim.secure.read()`, are not detectable later
(they will prompt again). https://github.com/neovim/neovim/discussions/33587#discussioncomment-12925887

Solution:
`vim.secure.read()` returns `true` if the user trusts a directory.

Also fix other bugs:

- If `f:read('*a')` returns `nil`, we treat that as a successful read of
  the file, and hash it. `f:read` returns `nil` for directories, but
  it's also documented as returning `nil` "if it cannot read data with the
  specified format". I reworked the implementation so we explicitly
  treat directories differently. Rather than hashing `nil` to put in the
  trust database, we now put "directory" in there explicitly*.
- `vim.secure.trust` (used by `:trust`) didn't actually work for
  directories, as it would blindly read the contents of a netrw buffer
  and hash it. Now it uses the same codepath as `vim.secure.read`, and
  as a result, works correctly for directories.
2025-04-30 04:20:39 -07:00
f02484118c fix(ui): correct condition for "wrap" flag in a floating grid
In a floating window grid, "wrap" flag should not
be set when vertical borders are used, as the the wrapped
text will be broken up by border chars.

fixes #33719
2025-04-30 12:29:03 +02:00
08c484f2ca feat(ui): use builtin completion popupmenu with ext_cmdline (#31269)
Problem:  UIs implementing ext_cmdline/message must also implement
          ext_popupmenu in order to get cmdline completion with
          wildoptions+=pum.
Solution: Allow marking a window as the ext_cmdline window through
          nvim_open_win(), including prompt offset. Anchor the cmdline-
          completion popupmenu to this window.
2025-04-29 15:55:00 +02:00
9bbbeb60e3 feat(ui): no delay for errors with ext_messages (#33693)
Problem:  Delay for reading a message may be unwanted for ext_messages,
          and can be done by the implementation. Empty completion source
          error message is not distinguishable as such.
Solution: Only delay without ext_messages enabled. Emit empty completion
          source message as an error.
2025-04-29 15:45:40 +02:00
ffb93d9883 Merge pull request #33667 from glepnir/vim-9.1.1341
vim-patch: 9.1.{1341,1344}
2025-04-29 14:59:32 +08:00
e7e665b489 vim-patch:ffc89e4 runtime(doc): clarify complete_match() and 'isexpand' option
clarify complete_match() documentation to better explain its backward
search behavior, argument handling, and return value format and add an
example of isexpand

closes: https://github.com/vim/vim/pull/17212

ffc89e47d0
2025-04-29 14:11:55 +08:00
c489b5a3e3 test(lua/secure_spec): avoid magic number (#33700)
Avoid magic number in skipping condition by moving the expected message
to a variable.
2025-04-29 01:44:54 +00:00
d107375f0c vim-patch:9.1.1353: missing change from v9.1.1350
Problem:  missing change from v9.1.1350
Solution: update the test Test_CmdlineTrigger() (Girish Palya)

related: vim/vim#17217

612f63bf81

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-29 07:15:22 +08:00