Commit Graph

37199 Commits

Author SHA1 Message Date
Justin M. Keyes
83ced05984 fix(ctx): coverity CHECKED_RETURN
CID 649145:         Error handling issues  CHECKED_RETURN
    /src/nvim/api/window.c: 138             in nvim_win_set_cursor()
    132       // Make sure we stick in this column.
    133       w->w_set_curswant = true;
    134
    135       // make sure cursor is in visible range and
    136       // cursorcolumn and cursorline are updated even if w != curwin
    137       CtxSwitch switchwin;
    >>>     CID 649145:         Error handling issues  (CHECKED_RETURN)
    >>>     Calling "ctx_switch" without checking return value (as is done elsewhere 5 out of 6 times).
    138       ctx_switch(&switchwin, w, NULL, NULL, kCtxNoEvents | kCtxNoDisplay);
    139       update_topline(curwin);
    140       validate_cursor(curwin);
    141       ctx_restore(&switchwin);
    142
    143       redraw_later(w, UPD_VALID);
2026-07-12 15:15:46 +02:00
Justin M. Keyes
d25ae8b8c2 refactor(input): rename getchar.c => input.c #40698
Problem:
`getchar.c` is a quirky name and doesn't align with our existing
`os/input.c` and `tui/input.c` modules, which encompass the same topic
at different layers.

Solution:
Rename `getchar.c` => `input.c` for discoverability.

Introduce `dialog.c` for functionality related to showing confirm
prompts, dialogs, etc.
2026-07-12 08:34:13 -04:00
Christian Clason
1227148ac3 build(deps): bump tree-sitter to d11d18f74 2026-07-12 12:13:02 +02:00
Barrett Ruth
41294e4253 docs(dir): remove augroup deletion note #40696 2026-07-11 18:20:27 -04:00
Barrett Ruth
67af4141c8 fix(filetype): false positive when matching directory buffer #40695
Problem:
URI buffer names can end with a slash, but slash-ended directory
matching should not preempt URI filetype patterns.

Solution:
Do not use the slash shortcut for names with URI schemes, so those
continue through normal filetype matching.

Co-authored-by: Adam Karafyllidis <akisarou90@gmail.com>
2026-07-11 18:19:44 -04:00
Justin M. Keyes
4349c386db refactor(ctx): drop switch_win/restore_win #40693 2026-07-11 13:29:59 -04:00
Justin M. Keyes
0f1e0a7900 refactor(ctx): drop aucmd_prepbuf/aucmd_restbuf #40692 2026-07-11 12:04:31 -04:00
Justin M. Keyes
f2d15fc0b0 refactor(input): ungetchars() usage #40685
Repurpose `ins_char_typebuf` to make its usage more obvious.
Rename it and update docs.
2026-07-11 10:53:30 -04:00
Justin M. Keyes
e3b50671ef Merge #40690 from justinmk/fixci
test: unreliable system_spec, vim_spec, tui_spec
2026-07-11 09:14:31 -04:00
Justin M. Keyes
d1b7a39fc3 test: unreliable "TUI split sequences within 'ttimeoutlen'"
FAILED   ...Xtest_xdg_terminal/test/functional/terminal/tui_spec.lua @ 1200: TUI split sequences work within 'ttimeoutlen' time
    .../runner/work/neovim/neovim/test/functional/ui/screen.lua:774: Row 1 did not match.
    Expected:
      |*^                                                  |
      |{100:~                                                 }|
      |{100:~                                                 }|
      |{100:~                                                 }|
      |*{3:[No Name]                                         }|
      |{5:-- INSERT --}                                      |
      |{5:-- TERMINAL --}                                    |
    Actual:
      |*�^                                                 |
      |{100:~                                                 }|
      |{100:~                                                 }|
      |{100:~                                                 }|
      |*{3:[No Name] [+]                                     }|
      |{5:-- INSERT --}                                      |
      |{5:-- TERMINAL --}                                    |
2026-07-11 14:46:48 +02:00
Justin M. Keyes
f2927bd919 test: unreliable "vim.system (async) supports timeout"
FAILED   2 tests, listed below:
    FAILED   …/lua/system_spec.lua:124: …/lua/system_spec.lua @ 44: vim.system (async) supports timeout
    …/lua/system_spec.lua:124: …/lua/system_spec.lua:44: process still exists
    stack traceback:
    D:/a/neovim/neovim/test/functional/testnvim/exec_lua.lua:124: in function 'system'
    …/lua/system_spec.lua:124: in function <…/lua/system_spec.lua:118>
    FAILED   …/lua/system_spec.lua:111: …/lua/system_spec.lua @ 22: vim.system (sync) can set environment with clear_env = true and env = nil
    …/lua/system_spec.lua:111: …/lua/system_spec.lua:22: process still exists
    stack traceback:
    D:/a/neovim/neovim/test/functional/testnvim/exec_lua.lua:124: in function 'system'
    …/lua/system_spec.lua:111: in function <…/lua/system_spec.lua:97>
2026-07-11 14:46:48 +02:00
Justin M. Keyes
141a498cca test: unreliable "API nvim_list_chans, nvim_get_chan_info stream=job :terminal channel"
FAILED   ...vim/build/Xtest_xdg_api/test/functional/api/vim_spec.lua @ 3256: API nvim_list_chans, nvim_get_chan_info stream=job :terminal channel
    Expected values to be equal.
    Expected:
    {
      argv = { "/home/runner/work/neovim/neovim/build/bin/nvim", "-u", "NONE", "-i", "NONE" },
      buf = 2,
      buffer = 2,
      exitcode = 1,
      id = 4,
      mode = "terminal",
      pty = "",
      stream = "job"
    }
    Actual:
    {
      argv = { "/home/runner/work/neovim/neovim/build/bin/nvim", "-u", "NONE", "-i", "NONE" },
      buf = 2,
      buffer = 2,
      exitcode = 129,
      id = 4,
      mode = "terminal",
      pty = "",
      stream = "job",
      <metatable> = {
        __tostring = <function 1>
      }
    }
    stack traceback:
    ...vim/build/Xtest_xdg_api/test/functional/api/vim_spec.lua:3300: in function <...vim/build/Xtest_xdg_api/test/functional/api/vim_spec.lua:3256>
2026-07-11 14:46:48 +02:00
Justin M. Keyes
757800bc64 Merge #40688 from justinmk/fixci 2026-07-11 08:46:39 -04:00
Justin M. Keyes
f1904f2a6c test(dir): "replace - mapping" hangs the Windows CI 2026-07-11 14:09:05 +02:00
Justin M. Keyes
8d51e07fa1 feat(eval): writefile() treats RPC string as "blob"
related: fb6aeaba2d
2026-07-11 13:49:52 +02:00
Justin M. Keyes
0f7bd6a3cd fix(diff): resource leak on :diffput E787 error path #40686
Coverity CID 649080/649081
2026-07-11 07:15:04 -04:00
Justin M. Keyes
eb2e695e40 test: "Failed to start server: address already in use" #40683
Problem:
unreliable test:

    FAILED   …/tui_spec.lua @ 895: TUI mouse events work with right-click menu (escape sequences sent to child)
    D:/a/…/testnvim.lua:144: Vim:Failed to start server: address already in use
    stack traceback:
    D:/a/…/testnvim.lua:144: in function 'eval'
    D:/a/…/testnvim.lua:1015: in function 'new_pipename'
    …/tui_spec.lua:897: in function <…/tui_spec.lua:895>

Solution:
Workaround potential PID reuse.
2026-07-11 06:52:04 -04:00
github-actions[bot]
7e9f384dde docs: update version.c #40609
Co-authored-by: marvim <marvim@users.noreply.github.com>
2026-07-11 04:19:55 -04:00
glepnir
59dbca9b0c fix(api): nvim_cmd() "args" type too narrow #40670
Problem: nvim_cmd() accepts number/boolean in args and converts them
to strings, but the keyset declares ArrayOf(String).

Solution: use ArrayOf(Union(Integer, String, Boolean)) and wrap union
types in parens when generating array annotations.
2026-07-10 20:34:08 -04:00
Barrett Ruth
784765cb73 fix(winbar): update hidden tabpages on global 'winbar' change #40608
Problem:
Changing global 'winbar' only updates window layout state in the current
tabpage. This means existing hidden tabs can keep stale winbar height.

Solution:
Recompute winbar state for all tabpages on global `'winbar'` changes.
2026-07-10 12:49:52 -04:00
Barrett Ruth
3b88a8a65d fix(filetype): ensure directory bufname ends w/ slash sep #40552
Problem:
`vim.filetype.match()` needs a cheap way to recognize directory buffers
without doing filesystem stat work.

Solution:
Ensure full buffer names for directories end in a trailing slash. Now
directory buffers can proceed through the normal 'filetype' path.

Note side-effects: session and ShaDa buffer-list restore behavior must
be compatible, so those + corresponding tests must be updated.
2026-07-10 12:40:13 -04:00
Barrett Ruth
20a4b1bc5e fix(dir): user/plugin can override default "-" mapping #40676 2026-07-10 11:52:24 -04:00
Justin M. Keyes
6a8bb2d62f refactor(ctx): simplify ctx_switch (40674 2026-07-10 09:08:58 -04:00
dependabot[bot]
435734e8db ci: bump the github-actions group across 1 directory with 2 updates
Bumps the github-actions group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/checkout` from 6 to 7
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

Updates `github/codeql-action` from 4.36.2 to 4.36.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v4.36.2...v4.36.3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: github/codeql-action
  dependency-version: 4.36.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-10 14:44:52 +02:00
Justin M. Keyes
d79c787f27 refactor(ctx): ctx_restore_curwin #40667
unify context-switching logic.

1. `prevwin` is now restored for all targets (was buf-only).
   - add a `nvim_win_call` test.
2. The buf-found "restore the shown buffer" dance no longer depends on
   the origin window: it runs even if the callback closed the origin.
2026-07-10 07:58:02 -04:00
bfredl
e684a3dd18 Merge pull request #38546 from dchinmay2/push-pozrrzptmvnv
build(zig): add formatc and lintc steps
2026-07-10 11:18:43 +02:00
Justin M. Keyes
edb043bf33 Merge #40661 from justinmk/unifyctx 2026-07-09 21:50:45 -04:00
Justin M. Keyes
d3ffc94110 refactor(cmdpreview): lift undo-checkpoint code
This is a mechanical lift of undo save-and-restore logic into... the
module that owns undo.
2026-07-10 03:27:37 +02:00
Justin M. Keyes
6bb1aa74e6 refactor: unify context-switching concepts 2026-07-10 03:27:37 +02:00
Justin M. Keyes
982d2f2531 fix(test): screen:expect({none=…}) with no any/grid
Problem:
`screen:expect({none=…})` with no any/grid crashed (concat on nil)
because actual_rows was only rendered when any or grid was present.

Solution:
Update the condition.
2026-07-10 00:06:59 +02:00
Barrett Ruth
7dccbfed10 fix(dir): select origin on parent navigation #40658 2026-07-09 17:47:56 -04:00
MAAZIZ Adel Ayoub
de141b4679 fix(socket): --listen silently truncates long paths #40625
Problem:
A `--listen` path longer than the system socket path limit (~104 bytes on
macOS, 108 on Linux) is silently truncated by `uv_pipe_bind()`. Nvim either
serves a socket at a different path than `v:servername` reports, or fails with
an error that blames the full untruncated path (confusing):

    nvim: Failed to --listen: address already in use: "<full path>"

Steps to reproduce:

    $ nvim --listen /var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/-Users-rpatterson-Projects-src-github.com-neovide-neovide --embed -p
    nvim: Failed to --listen: address already in use: "/var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/-Users-rpatterson-Projects-src-github.com-neovide-neovide"

    $ ls /var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/-Users-rpatterson-Projects-src-github.com-neovide-neovide
    "/var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/-Users-rpatterson-Projects-src-github.com-neovide-neovide": No such file or directory (os error 2)

    $ ls -l /var/folders/g7/9y_ydbnj2fs_fvp8xf44p8gc0000gn/T//nvim/
    srwxr-xr-x@ - rpatterson 31 Mar 10:24 -Users-rpatterson-Projects-src-github.com-neovid

Solution:
Bind with `uv_pipe_bind2()` and `UV_PIPE_NO_TRUNCATE` (libuv 1.46+), so
a too-long path fails up front with the actual reason:

    nvim: Failed to --listen: invalid argument: "<full path>"
2026-07-09 16:07:17 -04:00
Barrett Ruth
a54a7f6a78 fix(dir): preserve alternate buffer #40659 2026-07-09 15:41:09 -04:00
Justin M. Keyes
8c285c6c33 refactor(api): drop CmdParseInfo indirection #40657
Just Say No to indirection.
2026-07-09 13:30:33 -04:00
Vivek Kumar
bcbd9d7992 refactor(api): promote magic spec from CmdParseInfo to exarg_T #39119
Problem:
`magic` was owned by `CmdParseInfo`, but command handlers
need it at execution time via `exarg_T`.

Solution:
Move `magic` into `exarg_T`, and initialize it in `parse_cmdline()`.
2026-07-09 11:53:40 -04:00
Justin M. Keyes
55e3e4e984 build: bump minimum libuv #40648 2026-07-09 11:45:42 -04:00
Nathan Zeng
c0a16a5977 feat(restart)!: ZR restores session #40498 2026-07-09 07:09:12 -04:00
Christian Clason
e32874f17f build(deps): bump luajit to fed6d4782 2026-07-09 13:07:59 +02:00
Evgeni Chasnovski
fce6d9a549 feat(lua): add cwd context to vim._with() #40653
Problem: No concise way to execute a callback with temporarily set
  working directory. This might be useful when sourcing nested files to
  allow them to assume that current working directory is their root
  directory.

Solution: Add `cwd` context to `vim._with().`
2026-07-09 07:07:14 -04:00
Evgeni Chasnovski
3e9615b48a fix(options): set default 'packlockfile' respecting $NVIM_APPNAME #40651
Problem: The default 'packlockfile' value doesn't respect $NVIM_APPNAME.

Solution: Use more direct way of setting the default value, following
  the example of other options with a similar behavior.
2026-07-09 06:20:08 -04:00
zeertzjq
7c9222f45e fix(mouse): reset click count on next click if mouse moved (#40637)
Also, drop drag event if the mouse hasn't moved, like in gVim.
2026-07-09 08:40:00 +08:00
Justin M. Keyes
d55252a3ec refactor(logging)!: rename current_level #40642 2026-07-08 20:15:42 +00:00
Evgeni Chasnovski
0653e7a338 feat(pack): 'packlockfile' option #40562
Problem: No way to configure the lockfile location.

Solution: Add 'packlockfile' option.
2026-07-08 12:23:28 -04:00
Oleh Volynets
ef130902cf fix(lsp): clear push diagnostics on detach #40634
Problem: when an LS client detaches from the buffer, only pull diagnostics
are cleared via capability framework. Push diagnostics remain stuck even
when client stops/restarts.

Solution: clear push diagnostics on client detach.

ref #33864
2026-07-08 12:00:21 -04:00
Christian Clason
089662d318 build(deps): bump luajit to acb223497 2026-07-08 14:36:16 +02:00
Caleb White
653f2092ce fix(lsp): refresh document-pull buffers on workspace/diagnostic/refresh #40623
When a server supports both document and workspace pull diagnostics,
`on_refresh` only dispatched a `workspace/diagnostic` request.  The
workspace response handler skips buffers with `pull_kind == "document"`
(i.e. all buffers opened by the user), so their diagnostics went stale
until the next `didChange` or `didOpen` event.

Change `on_refresh` to always refresh document-pull buffers via
`textDocument/diagnostic`, regardless of whether the server also
supports workspace diagnostics.  This ensures that opened buffers
see updated diagnostics (e.g. after a save triggers an external
tool like PHPStan) without requiring the user to re-enter insert
mode.
2026-07-08 07:26:22 -04:00
Barrett Ruth
cfd7f29d52 feat(vim.fs): vim.fs.mkdir() #40599
Problem:
`vim.fs` does not provide a directory creation helper matching its
filesystem API shape.

Solution:
Add `vim.fs.mkdir()` as a thin wrapper around `vim.fn.mkdir()`, with
`parents` and `mode` options.
2026-07-08 07:16:29 -04:00
jdrouhard
6a6431cb99 refactor(lsp): use LspNotify for codelens #40604
Problem: The codelens LSP module was using its own raw buffer events and
its own debounce mechanism for refreshing code lens in attached buffers.

Solution: Switch the module to using the LspNotify autocmd events.
LspNotify fires just after document versions are synced with the server
and provides a built in debounce mechanism for changes.

Additionally, this fixes some bugs with the previous implementation:

1. The workspace/codeLens/refresh handler  re-requested codelens for all
   buffers but when the response came back, it forced an extra redraw
   after clearing the work the handler had just done.
2. Document synchronization was reworked to be more resilient to
   multiple clients providing codelens for a single buffer. The latest
   document version is now separately tracked per client (and per
   client's lenses per row) instead of for the buffer as a whole. This
   allows the on_win() function to properly redraw all codelens even
   when different clients' responses for a particular document version
   come back at different times.
2026-07-07 12:23:59 -04:00
Barrett Ruth
5231ad1357 fix(terminal): avoid E676 after failed :wqa (#40620) 2026-07-07 01:41:11 +00:00
Justin M. Keyes
18e27292e4 Merge pull #40619 fix(lua): statusline expr leaks into msg area 2026-07-06 17:21:03 -04:00