Skip to content

fix(editor): repeat visual indentation by line span - #355

Merged
fcoury merged 2 commits into
mainfrom
fix/visual-indent-dot-repeat
Aug 31, 2026
Merged

fcoury merged 2 commits into
mainfrom
fix/visual-indent-dot-repeat

Conversation

@fcoury

@fcoury fcoury commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Why

Red recorded a Visual indent as the raw keys used to construct its selection. That happened to work for forward selections, but dot-repeat could shift a different range after an upward selection because replay started from the first shifted line. Neovim repeats Visual indentation by the affected line span, independent of the motions that created the selection.

This is a follow-up to #205.

What Changed

  • Record Visual indent and unindent repeats by direction, selected line count, and shift count.
  • Reapply that span from the current line for ., preserving counts, EOF clamping, no-op repeat behavior, and gv selection recovery.
  • Compose normalized Visual shifts with trailing mapped actions and later input so custom compound mappings repeat in full.
  • Keep Visual shift dispatch behind boxed replay boundaries so visual-block dot-repeat remains safe on Red's constrained stack.
  • Document the repeat contract and add forward, reverse, moved-cursor, counted, unindent, no-op, and compound-mapping regression coverage.

How to Test

  1. Open a buffer with at least 25 lines and type 20GV9k>..
    • Expected: Red returns to Normal mode and only lines 11-20 are indented twice.
  2. In a fresh buffer, type ggV2j>5G..
    • Expected: lines 1-3 are indented once, then the same three-line span is indented at lines 5-7.
  3. Run cargo test --locked --test editing dot_ -- --nocapture.
    • Expected: the dot-repeat suite passes, including compound Visual mappings, later input, Visual indent/unindent, and the constrained-stack visual-block regression.

Validation

  • cargo test --locked --all-features -- --test-threads=1
  • cargo test --locked --test editing dot_ -- --nocapture
  • cargo test --locked --test editing visual_ -- --nocapture
  • cargo clippy --all-targets --all-features -- -D warnings
  • Real TUI smoke coverage for forward, reverse, and moved-cursor repeats

@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-31T22:42:24.899225Z 75e6062 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: 75e60624b0

ℹ️ 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/editor.rs Resolved
@fcoury
fcoury merged commit 0c8a8f8 into main Aug 31, 2026
14 checks passed
@fcoury
fcoury deleted the fix/visual-indent-dot-repeat branch August 31, 2026 23:02
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