Skip to content

fix(editor): seed multi-cursor from visual selection - #354

Merged
fcoury merged 3 commits into
mainfrom
fix/visual-selection-multi-cursor
Aug 31, 2026
Merged

fix(editor): seed multi-cursor from visual selection#354
fcoury merged 3 commits into
mainfrom
fix/visual-selection-multi-cursor

Conversation

@fcoury

@fcoury fcoury commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Characterwise Visual selections could not start a multi-cursor session with Ctrl-n. The key was only reachable in Normal mode, and the occurrence engine only knew how to derive a whole word from the cursor rather than consume an explicit selection.

This change lets a single-line characterwise Visual selection seed multi-cursor editing directly. The selected text is matched literally, the next occurrence is added immediately, and Red transitions through its normal Visual-to-Normal path so gv can restore the original selection. Normal-mode Ctrl-n keeps its whole-word behavior. Multiline, Visual Line, and Visual Block selections remain unchanged and a multiline character selection reports the supported boundary.

The multi-cursor guide and Vim compatibility matrix now describe both entry paths.

How to Test

  1. Open a buffer containing foobar foo foobar, place the cursor on the first f, and press vll followed by Ctrl-n.
    Expected: Red enters MULTI 2/2, selecting the foo prefix and the standalone next foo.
  2. Press c, type X, and press Esc.
    Expected: the line becomes Xbar X foobar; one u restores the entire edit.
  3. Make a characterwise Visual selection that crosses a newline and press Ctrl-n.
    Expected: Red remains in Visual mode and reports that occurrence selection requires a single-line Visual selection.
  4. From Normal mode, press Ctrl-n on a word beside a longer identifier containing that word.
    Expected: the existing whole-word selection behavior is unchanged.

Focused automated coverage:

  • cargo test --test multi_cursor
  • cargo test --lib editing::multi_selection::tests
  • cargo clippy --all-targets --all-features -- -D warnings

@fcoury

fcoury commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T21:46:33.760252Z 9b8e532 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b8e532bba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread src/editing/multi_selection.rs
@fcoury
fcoury merged commit f7ea02d into main Aug 31, 2026
14 checks passed
@fcoury
fcoury deleted the fix/visual-selection-multi-cursor branch August 31, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant