detached b6b7265

fix(copy): keep off-frame selected cursors covered

commit
b6b72659a082d516643a1993d4e91375305005e4
author
brice · · 2026-10-05 07:32 UTC
parent
cb18da6
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +11 -4
M internal/usecase/copy/content_render_test.go +6 -3
@@ -78,10 +78,13 @@ func TestRenderRowsSelectionAfterHistoryResize(t *testing.T) {
7878 m.navigator.Pos = Pos{0, 0}
7979 m.ViewportTop = 0
8080 m.selection = Selection{Anchor: Pos{0, 0}, Active: Pos{1, 0}, Granularity: Character, Enabled: true}
81- f := m.Render(vt.DefaultStyle(), vt.Style{HasBackgroundRGB: true})
8281 require.Equal(t, "abc xyz\nq", m.SelectedText())
83- for x := 0; x < 8; x++ {
84- require.True(t, f.At(x, 0).Style.Inverse, "visible content column %d", x)
82+ for _, col := range []int{0, 10} {
83+ m.navigator.Pos = Pos{0, col}
84+ f := m.Render(vt.DefaultStyle(), vt.Style{HasBackgroundRGB: true})
85+ for x := 0; x < 8; x++ {
86+ require.True(t, f.At(x, 0).Style.Inverse, "cursor %d, visible content column %d", col, x)
87+ }
8588 }
8689 }
8790
@@ -78,10 +78,13 @@ func TestRenderRowsSelectionAfterHistoryResize(t *testing.T) {
78 m.navigator.Pos = Pos{0, 0}78 m.navigator.Pos = Pos{0, 0}
79 m.ViewportTop = 079 m.ViewportTop = 0
80 m.selection = Selection{Anchor: Pos{0, 0}, Active: Pos{1, 0}, Granularity: Character, Enabled: true}80 m.selection = Selection{Anchor: Pos{0, 0}, Active: Pos{1, 0}, Granularity: Character, Enabled: true}
81- f := m.Render(vt.DefaultStyle(), vt.Style{HasBackgroundRGB: true})
82 require.Equal(t, "abc xyz\nq", m.SelectedText())81 require.Equal(t, "abc xyz\nq", m.SelectedText())
83- for x := 0; x < 8; x++ {82+ for _, col := range []int{0, 10} {
84- require.True(t, f.At(x, 0).Style.Inverse, "visible content column %d", x)83+ m.navigator.Pos = Pos{0, col}
84+ f := m.Render(vt.DefaultStyle(), vt.Style{HasBackgroundRGB: true})
85+ for x := 0; x < 8; x++ {
86+ require.True(t, f.At(x, 0).Style.Inverse, "cursor %d, visible content column %d", col, x)
87+ }
85 }88 }
86 }89 }
87 90
M internal/usecase/copy/mode.go +5 -1
@@ -609,7 +609,11 @@ func (m *Mode) RenderRowsRange(start, end int, paint func(int, []renderer.Cell),
609609 if n < d.RowWidth(src) {
610610 limit = d.contentEnd(src)
611611 }
612- if r, ok := selectionBounds.rangeForCells(src, row, limit); ok {
612+ r, ok := selectionBounds.rangeForCells(src, row, limit)
613+ if n < d.RowWidth(src) {
614+ r, ok = selectionBounds.rangeForRow(d, src)
615+ }
616+ if ok {
613617 for x := max(r.Start, 0); x <= min(r.End, len(row)-1); x++ {
614618 toggleInverse(&row[x].Style)
615619 }
@@ -609,7 +609,11 @@ func (m *Mode) RenderRowsRange(start, end int, paint func(int, []renderer.Cell),
609 if n < d.RowWidth(src) {609 if n < d.RowWidth(src) {
610 limit = d.contentEnd(src)610 limit = d.contentEnd(src)
611 }611 }
612- if r, ok := selectionBounds.rangeForCells(src, row, limit); ok {612+ r, ok := selectionBounds.rangeForCells(src, row, limit)
613+ if n < d.RowWidth(src) {
614+ r, ok = selectionBounds.rangeForRow(d, src)
615+ }
616+ if ok {
613 for x := max(r.Start, 0); x <= min(r.End, len(row)-1); x++ {617 for x := max(r.Start, 0); x <= min(r.End, len(row)-1); x++ {
614 toggleInverse(&row[x].Style)618 toggleInverse(&row[x].Style)
615 }619 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close