Skip to content

Follow-ups from #364-#371: openFile with a pending operator, preview selection, selection edge cases #374

Closed

Description

@ThomasK33

Verification of #364 to #371 (the fixes for #362) found these. Each one is on main before those PRs too, or is a narrow case the PRs did not claim to cover. Items 1 to 3 come first.

  1. openFile with a pending operator: a deferred key reader can still let the operator act. fix(open_file): never change the buffer when openFile selects #370 cancels a pending operator (user typed d) by feeding <Esc>. If the opened buffer has a BufEnter callback that uses vim.schedule to read a key (getchar, confirm, a vim.ui prompt) or runs nvim_feedkeys(..., "x"), that reader eats the <Esc>. The user's next w then deletes from where they typed d to openFile's cursor (149 lines in the advisor's probe, Neovim 0.8.3 and 0.12.3). It needs that third-party hook shape.
  2. openFile after A<C-o>d: the cancel returns to Insert mode, so the user's next key is inserted as text (one|wtwo|three|four).
  3. openFile with preview: true puts the selection in the main window's buffer, not in the previewed file.
  4. Smaller openFile gaps. The reply has no cancel note for a plain openFile (no range). An error after openFile moved windows leaves the operator pending. With makeFrontmost: false, a safe pending d is cancelled. On Neovim 0.12.3, openFile from Insert mode stays in Insert mode and selects nothing. On 0.8 to 0.10, a partly typed command line is lost. From the command-line window it fails with E11.
  5. Selection tracking.
    • With 'selectmode' containing cmd, a Select-mode selection reaches Claude as an empty selection.
    • A selection that runs past the end of the line (v$) is sent without the line break Neovim yanks, with end = line length + 1.
    • On Neovim 0.11+, a combining mark right after a control character (TAB, NUL, ESC) makes the end one character different from Neovim's yank.
  6. Column units. The plugin sends 0-based UTF-8 byte offsets. VS Code positions count UTF-16 code units, so the numbers differ on non-ASCII lines. Decide which one Claude expects.
  7. filePath/fileUrl are not cleaned. A buffer name with invalid UTF-8 can still reach the client as invalid text (the selection text is cleaned since fix(selection): end charwise and blockwise selections on a whole character #367).
  8. Neovim 0.8.3 core quirk. Reading vim.bo[other], nvim_get_option_value(..., {buf = other}) or nvim_buf_call(other, ...) while an exclusive Visual selection ends past the end of a line moves the end back one column. A third-party plugin that walks buffers during Visual mode would shrink the user's selection. Fixed in Neovim 0.9.5.
  9. CI and test hygiene.
    • The integration-tests (v0.8.0) leg installs a dev build (v0.8.0-1210-gd367ed9b2), not the 0.8.0 release, and CI clones plenary.nvim at its latest commit.
    • fixtures/issue-238/README.md:44 still shows the nvim -l command, which hangs on 0.8.
    • Shuffled busted runs fail in mcp_tools_spec, init_spec and diff_ui_cleanup_spec (also without the new specs).

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

Activity

  1. self-assigned this
    on Nov 1, 2026
  2. ThomasK33 commented on Nov 1, 2026

    @ThomasK33
    MemberAuthor

    All items are handled on main:

    1, 2 and 4. openFile in the middle of a command: #382, merged as 363401d. When the user is mid-command (pending operator, Insert, Replace, <C-o>, command line), openFile now shows the file in the preview window, moves no cursor in the user's window, selects nothing and sends no keys, so no key reader can turn the user's next key into a deletion. The command-line window and a command started in the preview window get a clean -32000. Its follow-up #384, merged as ac3dc07, keeps later openFile and openDiff calls out of that preview window.
    3. preview: true selection: #375, merged as ed9000e.
    5. Selection tracking edge cases (Select mode, v$ line break, control character plus combining mark on 0.11+, empty-line ends): #381, merged as dc52132.
    6. Column units: no code change. Claude Code CLI 2.1.312 reads character only to check end.character === 0, so the plugin keeps UTF-8 byte offsets. #379, merged as 1110fa2, documents the units and the encoding in PROTOCOL.md.
    7. Paths and every other outbound text are valid UTF-8: #378, merged as 96a4774.
    8. Neovim 0.8.3 core quirk: no change. It is Neovim core behavior that 0.9.5 fixed, and the plugin itself triggers it on no path.
    9. CI and test hygiene: #377, merged as 7ea714d (the v0.8.0 leg already used the release, plenary pinned, fixture README fixed, suite passes in any order), plus #380, merged as 5d117c8 (fixture header and verify-claudecode-nvim evidence permissions).

    Each PR had an independent verifier pass on real Neovim before merge. New findings go to the next follow-up issue.


    Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs-triageAwaiting maintainer triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions