Skip to content

feat(review): make inline notes keyboard selectable - #1044

Merged
benvinegar merged 1 commit into
mainfrom
feat/review-note-keyboard-selection
Sep 8, 2026
Merged

benvinegar merged 1 commit into
mainfrom
feat/review-note-keyboard-selection

Conversation

@benvinegar

@benvinegar benvinegar commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Problem

Inline review comments rendered between source lines, but keyboard movement skipped over them and note actions depended on mouse-only controls. This made threaded comments difficult to review and operate on from the keyboard.

Approach

  • add shared active-note identity and exact-note selection to review state, intents, and wire parsing
  • build terminal vertical stops from measured rendered geometry so j/k and Up/Down visit source lines, comments, and every reply in order
  • classify n/N as presentation-local and resolve them from the active surface’s measured note order before dispatching validated exact-note selection
  • expose R, E, and D for replying to, editing, and deleting the active leaf note
  • activate a note after saving it or clicking its card; hovering remains pointer-only and does not change selection
  • reveal selected note cards minimally and support both raw diffs and alternate file views

Text/range selection remains source-line-only, and ordinary row navigation still clears note focus so line and note selection cannot be active together.

Validation

  • TMPDIR=/var/tmp bun run test
  • bun run typecheck
  • bun run lint
  • bun run deps:check
  • bun test ./test/review-conformance
  • bun test test/pty/notes.test.ts
  • bun run test:tty-smoke
  • focused core, hook, component, command-catalog, protocol, and vertical-stop suites
  • independent final diff review

Tested on Linux. The PTY tests drive the real TUI for keyboard, mouse, save, thread, and narrow-layout behavior. No separate video is attached.

Release

Includes a minor Changeset for hunkdiff.

This PR description was generated by Pi using gpt-5.6-sol

@vercel

vercel Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
hunk-web Ignored Ignored Preview Sep 8, 2026 1:45am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds persistent keyboard focus for inline review notes and integrates notes into both semantic and rendered vertical navigation.

  • Adds exact active-note identity to review state, intents, selectors, reduction, and wire parsing.
  • Makes j/k traverse measured source-line and note-card stops while n/N navigate semantic notes.
  • Adds keyboard reply, edit, and leaf-note deletion actions, visible active-card styling, and click activation.
  • Covers raw diffs, alternate file views, threaded replies, narrow layouts, and PTY interaction flows with focused tests.

Confidence Score: 5/5

The PR appears safe to merge; no concrete correctness, security, or repository-rule issue remains.

Active-note state, navigation, action targeting, rendering, protocol parsing, and reconciliation are coherently integrated and covered by unit, component, conformance, and PTY tests.

Important Files Changed

Filename Overview
packages/hunk/src/core/review/selectors.ts Defines visibility-aware active-note resolution, semantic note ordering, and capability-specific action targets.
packages/hunk/src/core/review/intents.ts Adds validated exact-note selection and semantic note movement while preserving atomic selection state.
packages/hunk/src/core/review/reducer.ts Persists and clears active-note identity across selection, visibility, removal, and save operations.
packages/hunk/src/ui/hooks/useTerminalReview.ts Coordinates mutually exclusive line and note focus and moves through measured mixed vertical stops.
packages/hunk/src/ui/components/panes/DiffPane.tsx Builds measured vertical stops, renders active-note metadata, and reveals exact line or note rows.
packages/hunk/src/ui/components/panes/AgentInlineNote.tsx Adds persistent active-card styling, resolved keyboard labels, click activation, and narrow-width action fitting.
packages/hunk/src/ui/lib/reviewVerticalStops.ts Flattens rendered geometry into stable, ordered source-line and semantic-note keyboard targets.
packages/hunk/src/core/run/commandCatalog.ts Registers note navigation and deletion commands and lowers them through active-note capability policies.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Input["Keyboard or mouse input"] --> Route{"Navigation type"}
    Route -->|"j / k or Up / Down"| Stops["Measured vertical stops"]
    Stops --> Line["Source-line cursor"]
    Stops --> Note["Exact note identity"]
    Route -->|"n / N"| Semantic["Semantic visible-note ordering"]
    Semantic --> Note
    Route -->|"Click note card"| Note
    Note --> State["Review state: selection + activeNoteId"]
    Line --> State
    State --> Render["Diff pane rendering and minimal reveal"]
    State --> Actions{"Active-note capabilities"}
    Actions -->|"R"| Reply["Reply draft"]
    Actions -->|"E"| Edit["Edit user note"]
    Actions -->|"D"| Delete["Remove leaf note"]
Loading

Reviews (1): Last reviewed commit: "feat(review): make inline notes keyboard..." | Re-trigger Greptile

@benvinegar
benvinegar force-pushed the feat/review-note-keyboard-selection branch from 2beed3f to 11a2fd6 Compare September 8, 2026 00:48
@benvinegar
benvinegar force-pushed the feat/review-note-keyboard-selection branch from 11a2fd6 to aef0240 Compare September 8, 2026 01:45
@benvinegar
benvinegar merged commit 2124066 into main Sep 8, 2026
12 checks passed
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