Skip to content

feat(ui): select exact diff lines with mouse - #840

Merged
benvinegar merged 1 commit into
mainfrom
feat/mouse-line-selection
Aug 25, 2026
Merged

benvinegar merged 1 commit into
mainfrom
feat/mouse-line-selection

Conversation

@benvinegar

@benvinegar benvinegar commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • select the exact diff line and split side when clicking anywhere on a rendered row, including blank lines
  • use OpenTUI's painted viewport/content coordinates so selection remains accurate after scrolling and pinned-header handoffs
  • keep multi-row copy drags captured by the persistent scrollbox while highlighted rows repaint, and resolve coalesced motion at mouse-up
  • treat one-cell pointer jitter as a click while preserving deliberate drag, double-click, triple-click, and --cursor-line off copy behavior
  • isolate the [+] affordance so it only opens the note composer

Testing

  • bun run typecheck
  • bun run lint
  • bun run deps:check
  • bunx oxfmt --check on changed files
  • full PTY suite: 120 passed; the sole local ENOEXEC spawn failure passed on focused rerun after removing a shadowing node_modules/.bin/bun left by dependency repair
  • focused component and unit tests, including double/triple-click copy expansion
  • raw SGR mouse verification in a live Herdr/tmux pane: selection visibly extended row-by-row across eight rows and copied on release
  • independent subagent review (no remaining actionable findings)

Local environment note

  • bun test: 3241 passed and 19 skipped; the remaining failures/errors come from the globally installed hunk-lens extension being discovered by the local test run

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

@vercel

vercel Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hunk-web Ignored Ignored Preview Aug 25, 2026 1:26am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes mouse gestures select the exact rendered diff line and split side using OpenTUI’s painted viewport coordinates while preserving deliberate copy gestures and nested control ownership.

  • Resolves clicked rows to semantic line cursors, including wrapped and context rows.
  • Treats one-cell pointer movement as click jitter while retaining double-click, triple-click, drag-copy, and cursor-line-disabled behavior.
  • Isolates add-note and header-badge mouse actions from parent line selection.
  • Adds focused unit, component, host-selection, and PTY regression coverage.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified.

The mouse-selection changes preserve deliberate and expanded copy gestures, use painted viewport geometry for scrolled hit testing, isolate nested controls, and include focused coverage for the principal interaction paths.

Important Files Changed

Filename Overview
src/ui/components/panes/DiffPane.tsx Replaces reconstructed hit-test coordinates with measured OpenTUI geometry and routes click-like gestures to exact line selection without disrupting copy gestures.
src/ui/components/panes/copySelection.ts Adds row-to-line-cursor resolution and explicit one-cell click-slop classification with expanded-selection protection.
src/ui/diff/renderRows.tsx Marks nested diff-row controls so add-note and header-badge actions do not also trigger parent line selection.
src/ui/components/ui-components.test.tsx Covers exact split-side and blank-line selection, click jitter, deliberate copy drags, and isolated add-note behavior.
test/pty/cursor-line.test.ts Adds terminal-level regression coverage for jitter-tolerant exact-line selection before and after scrolling.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Mouse press on diff row] --> B[Resolve painted viewport point]
    B --> C{Nested row control?}
    C -->|Yes| D[Run nested action only]
    C -->|No| E{Click or one-cell jitter?}
    E -->|Yes| F[Resolve row bounds and split side]
    F --> G[Select semantic line cursor]
    E -->|No| H[Normalize deliberate drag range]
    H --> I[Copy rendered selection]
Loading

Reviews (1): Last reviewed commit: "feat(ui): select exact diff lines with m..." | Re-trigger Greptile

@benvinegar
benvinegar force-pushed the feat/mouse-line-selection branch from 031c55e to 7b682ef Compare August 25, 2026 01:26
@benvinegar
benvinegar merged commit bff4fbe into main Aug 25, 2026
12 checks passed
@benvinegar
benvinegar deleted the feat/mouse-line-selection branch August 25, 2026 01:42
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