Commit 5d3157f
Empty-space click on hunk bar recenters viewport on cursor (minimap-style)
Clicking empty bar space — anywhere that's neither a hunk marker nor
the viewport band — now snaps the band's center to the cursor and
enters a sticky-thumb drag in the same gesture. A quick click jumps
the editor to that fraction of the file; press-and-drag continues
scrubbing without releasing.
Implemented by extending the existing drag path: in
OnMouseLeftButtonDown's empty branch (which previously bubbled), set
_bandDragOffsetFromTop = bandHeight/2 so the cursor maps to the band's
center, transition directly to BarInteractionState.Dragging (skipping
PendingClick — we want the scroll to fire on MouseDown, not require a
MouseMove), and emit one EmitDragScroll. All downstream behaviour
(ghost-band paint, scroll request, MouseUp ending the drag without a
JumpToHunk) flows from the existing Dragging state. No new public
surface; just the new empty-space branch.
If no band exists yet (no file loaded / pre-layout) the click bubbles
as before — nothing meaningful to center on.
AI-Local-Session: b53d5fe5-38cc-41dd-b987-3def5ef3f0d3
AI-Cloud-Session: 744dd836-01e5-48af-91db-daa8241a01d7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 9130979 commit 5d3157f
2 files changed
Lines changed: 34 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
359 | 362 | | |
360 | 363 | | |
361 | 364 | | |
362 | | - | |
363 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
364 | 389 | | |
365 | 390 | | |
366 | 391 | | |
| |||
0 commit comments