Repository navigation
fix(open_file): count a grown file, honor 'eventignorewin', and keep one terminal window - #396
Conversation
…lback gaps of #393 - A file that grew on disk while its buffer is loaded without unsaved changes gets -32602 for a startLine past the old end, although openFile loads the new text before it selects. - With 'noautoread' and 'eventignorewin' set to ignore FileChangedShell in the windows that show the buffer, openFile's :checktime makes Neovim ask the user (W11). - With only a terminal, or a terminal and the preview window, preview = true leaves a second window on the terminal. The specs fail until the next commit. The preview mock now models 'eventignorewin' and reads the changed file, and the fallback mock models the preview path. _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
…nged file unread With 'autoread', Neovim loads a changed file without FileChangedShell, so 'eventignore' cannot make it ask. openFile still skips :checktime then, and searches the old text. The new 'eventignorewin' case pins the same rule. The preview mock now reads 'autoread' through getbufvar(). _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
…one terminal window - startLine: for a loaded buffer without unsaved changes, openFile now also counts the file on disk, because it loads the file again when it changed. A startLine on a line Claude added is no longer -32602. - openFile skips :checktime when 'eventignorewin' (Neovim 0.11+) ignores FileChangedShell, as Neovim reads it: the current window when it shows the buffer, else every window that shows it. With 'noautoread', :checktime then asked the user (W11). With 'autoread', openFile now checks the file even when 'eventignore' or 'eventignorewin' ignores the event, because Neovim then loads it without FileChangedShell and does not ask. - With preview and no editor window, the fallback no longer splits the terminal: the preview window takes the file, so the second window on the terminal is gone. tools/README.md now names the 'eventignorewin' rule, the grown-file count, and what an erroring user FileChangedShell or BufReadPost autocommand does during a reload (openFile fails, as :checktime does, and the buffer keeps the old text). _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
|
@codex review |
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…d file The advisor pass found statements in tools/README.md that do not hold: - 'eventignorewin' for a hidden buffer is Neovim's own check, not a rule openFile applies. The README now names the rule openFile uses for a window that already shows the buffer, and says that Neovim decides for a window that did not show it. - A buffer opened while its file did not exist gets W13, which runs no FileChangedShell. That is a third case. - An Ex `:checktime` that the user types finishes the reload despite an erroring BufReadPost autocommand. openFile's call from Lua stops it. After a FileChangedShell error a later `:w` still warns. After a BufReadPost error it does not. _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
|
@codex review |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…, #397, #399 check.sh --mutants caught every guard on the tree merged with #394. This merge changes no fact (all 21 read TRUE) and not the model, so the mutant result holds. check.sh passes. _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
Besides server/client.lua and server/frame.lua, the record takes in the selection.lua, tools/open_file.lua and visual_commands.lua changes from #396 and #397, which main had not recorded. None of them reaches diff state, an openDiff answer, a disconnect or a diff command: the only diff word in them is open_file's check of a window's 'diff' option. Part of #393 _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
Why
This PR is one of the small, reviewed fixes that close the open follow-up issues in claudecode.nvim (#393). It covers the four openFile items of #393 item 4, which came from #387.
-32602 startLine N is past the end of the file, although openFile loads the new text before it selects. Claude could not select a line it had just added.:checktimemade Neovim ask W11. The reply waited for the user's answer. The README said Neovim can still ask "in two cases", and this was a third.preview = trueleft a second window on the terminal.What changed
All code changes are in
lua/claudecode/tools/open_file.lua.:checktimewhen 'eventignorewin' ignores FileChangedShell the way Neovim reads it (apply_autocmds_group()): the current window when it shows the buffer, else every window that shows it. While testing I found that the skip was too wide. With 'autoread', Neovim reloads a clean buffer without FileChangedShell, so 'eventignore' cannot make it ask. openFile now skips only with 'noautoread'. Before, 'eventignore' with 'autoread' left the old text.:editdoes. tools/README.md says what happens. openFile fails with that error, and the reload stops, unlike a:checktimethe user types: the buffer keeps the old text. After a FileChangedShell error a later:wwarns that the file changed. After a BufReadPost error two empty lines are added, Neovim takes the new file as read, and a later:wwrites over it without a warning. Main does the same. Making openFile's reload finish like a typed:checktimeis a follow-up.lua/claudecode/tools/README.mddescribes the line count, the 'eventignorewin' rule, the autocommand errors, and the preview fallback. It now lists three cases where Neovim can still ask: FileChangedShell ignored for Neovim's own check when openFile shows the buffer in a new window, a user's autocommand that deletes openFile's, and W13 for a buffer opened before its file existed (W13 runs no FileChangedShell). The docs commit a0b4ee8 corrects statements an advisor pass found untrue.Scope
Blast Radius
openFile only. The line count changes only for a loaded buffer without unsaved changes, and only when
startLineis past its last line. The:checktimeskip changes only with 'eventignorewin' set, or 'eventignore' with 'autoread'. The fallback changes only withpreview = trueand no editor window.Verification
setlocal eventignorewin=FileChangedShell, then Claude rewrites the shown file and calls openFile. On main the W11 dialog blocks the reply. Now the reply comes at once and nothing asks.startLine = 6. On main:-32602 startLine 6 is past the end of the file (4 lines). Now openFile answersOpened file and selected lines 6 to 6and line 6 showssix from Claude.preview = truekeeps one window, also with the preview window and withmakeFrontmost = false.v:warningmsgto W11 (the question) in 4 scenarios on 0.12.3, and this PR in none.vim.cmd("checktime")from Lua.:checktime). Commit a0b4ee8 corrects them.mise run check,mise run test(963 passed, shuffled), and the integration suite on 0.8.3 and 0.12.3 (29 passed each) pass.Before the fix, 'eventignorewin' makes openFile's check ask W11, and the reply waits:
After the fix, openFile selects line 6, which Claude just added:
Part of #393
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh