Skip to content

feat: add shift range commenting#2

Merged
osolmaz merged 2 commits into
mainfrom
feat/shift-range-selection
Jul 10, 2026
Merged

feat: add shift range commenting#2
osolmaz merged 2 commits into
mainfrom
feat/shift-range-selection

Conversation

@osolmaz

@osolmaz osolmaz commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

Keyboard users had to enter a separate selection mode before commenting on a range.
This change makes Shift-Up and Shift-Down extend a line range and opens the comment editor when Shift is released.
Saved range comments now keep a green rail beside every covered source line, so their full anchor remains visible.

What Changed

The keyboard and mouse flows now share the same range-selection model.
The terminal requests enhanced key events where supported and retains a next-key fallback for older terminals.

  • Added forward and reverse Shift-arrow selection with modifier-release handling.
  • Added safe keyboard-enhancement setup and restoration alongside the existing terminal guard.
  • Added persistent range rails, including an active style for the selected comment.
  • Kept the footer focused on save/cancel while preserving standard Emacs-style editor shortcuts.
  • Updated the user controls and tmux end-to-end scenario.

Testing

Unit, rendering, architecture, and real pseudoterminal interactions pass locally.
The complete mutation, coverage, audit, documentation, and compatibility gate is clean.

  • cargo test --workspace --all-targets
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • scripts/e2e-tmux.sh
  • scripts/ci-local.sh
  • cargo +1.88.0 check --workspace
  • 54 unit tests and 3 architecture tests passed.
  • LLVM line coverage passed at 97.38% for in-process production modules.
  • 118 scoped mutants ran: 114 caught and 4 unviable, with no survivors.
  • Slophammer DRY, boundaries, unsafe, and complete checks passed with no findings.

Risks

Modifier-release events depend on terminal keyboard-protocol support.
Compatible terminals open the editor immediately on Shift release; older terminals finalize the range on the first subsequent unshifted key and apply that key to the editor.

  • Keyboard enhancement flags are pushed and popped through the same cleanup path used for raw mode and mouse capture.
  • Mouse selection and the existing v selection mode remain available.

@osolmaz osolmaz marked this pull request as ready for review July 10, 2026 12:43
@osolmaz

osolmaz commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

Final implementation report

This change adds keyboard-driven range commenting while keeping the interface focused:

  • Shift+Up and Shift+Down extend the current line selection.
  • Releasing Shift opens the comment editor. Terminals that do not report modifier-release events fall back cleanly when the next ordinary key arrives.
  • Pressing Enter after a legacy-terminal selection opens the editor without immediately submitting an empty comment.
  • Every source line covered by a saved comment displays a green range rail, so the full commented range remains visible.
  • The footer no longer advertises Ctrl+A, Ctrl+E, or Ctrl+O; the underlying basic Emacs-style editing shortcuts remain available.
  • The tmux end-to-end test exercises real Shift-arrow escape sequences, modifier release, comment entry, persistent range rails, and Markdown output.

Verification

  • cargo test --workspace --all-targets: 54 unit tests and 3 architecture tests passed.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings: passed.
  • scripts/e2e-tmux.sh: passed for mouse and Shift-keyboard commenting flows.
  • scripts/ci-local.sh: passed.
  • Line coverage: 97.38%.
  • Mutation testing: 118 mutants evaluated; 114 caught and 4 unviable, with no survivors.
  • Dependency audit: no known vulnerabilities.
  • Slophammer and SimpleDoc checks: clean.
  • Rust 1.88 compatibility check: passed.
  • Codex review: no P0 or P1 findings. The sole P2 finding was fixed and covered by a regression test.
  • GitHub Actions: both verify and rust 1.88 passed.

@osolmaz osolmaz merged commit cadfbcc into main Jul 10, 2026
2 checks passed
@osolmaz osolmaz deleted the feat/shift-range-selection branch July 10, 2026 12:50
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