Skip to content

feat: make comments keyboard-focusable#3

Merged
osolmaz merged 2 commits into
mainfrom
feat/keyboard-comment-focus
Jul 10, 2026
Merged

feat: make comments keyboard-focusable#3
osolmaz merged 2 commits into
mainfrom
feat/keyboard-comment-focus

Conversation

@osolmaz

@osolmaz osolmaz commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

Keyboard navigation skipped inline comments, so editing an existing comment was not a complete keyboard flow.
Up/Down and j/k now stop on comment rows, and Enter opens the focused comment for editing.
The focused comment gets its own marker and stays visible while the document scrolls.

What Changed

Comments now participate in the same semantic navigation order users see on screen.
Source range selection remains source-oriented, while normal browsing can move through source lines and comments.

  • Added semantic source/comment browse targets in document order.
  • Made Enter edit a focused comment while retaining its create-comment behavior on source lines and ranges.
  • Added a ▶─ focus marker to inline comments and hid the source marker while comment focus is active.
  • Kept focused comments inside the viewport, including in long documents.
  • Updated the keyboard controls documentation.

Testing

The new flow is covered from app state through a real tmux pseudoterminal session.
The tmux scenario creates a comment, restarts without mouse support, navigates to the inline comment, opens it, changes it, saves it, and verifies the resulting Markdown.

  • cargo fmt --all -- --check
  • cargo test --workspace --all-targets — 58 unit tests and 3 architecture tests passed.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • scripts/e2e-tmux.sh
  • scripts/ci-local.sh — 97.55% line coverage; 132 mutants tested, with 127 caught and 5 unviable; dependency audit, Slophammer, and SimpleDoc checks passed.
  • cargo +1.88.0 check --workspace

Risks

Risk is low because the change is limited to browse focus and rendering state.
Mouse editing, Shift range selection, page movement, and output formats retain their existing paths and remain covered by the full gate.

@osolmaz

osolmaz commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

Final implementation report

Saved comments are now fully editable with the keyboard:

  • Up/Down and j/k traverse source lines and inline comments in their rendered order.
  • A focused comment displays a ▶─ marker while the source cursor marker is hidden.
  • Enter opens the focused comment for editing; e and d continue to edit and delete it.
  • Leaving a focused comment with vertical navigation reaches the adjacent source line, including when only one comment exists.
  • Focused comments are scrolled into view in long documents.
  • Shift range selection remains source-line based.
  • The tmux end-to-end scenario restarts with --no-mouse, navigates to an existing comment, edits it, saves it, and verifies the changed Markdown output.

Verification

  • cargo fmt --all -- --check: passed.
  • cargo test --workspace --all-targets: 58 unit tests and 3 architecture tests passed.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings: passed.
  • scripts/e2e-tmux.sh: passed for mouse creation, keyboard editing, Shift range selection, and all output modes.
  • scripts/ci-local.sh: passed.
  • Line coverage: 97.55%.
  • Mutation testing: 132 mutants evaluated; 127 caught and 5 unviable, with no survivors.
  • Dependency audit: no known vulnerabilities.
  • Slophammer and SimpleDoc checks: clean.
  • cargo +1.88.0 check --workspace: passed.
  • codex review --base main: no findings.
  • GitHub Actions: rust 1.88 and verify passed.
  • GitHub feedback: no issue comments, inline comments, reviews, or unresolved review threads after the feedback window.

@osolmaz osolmaz merged commit 48a0758 into main Jul 10, 2026
2 checks passed
@osolmaz osolmaz deleted the feat/keyboard-comment-focus branch July 10, 2026 13: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