v0.5.0 31affde

resize_reflow_regression_test.go RawHistoryFolder

1package vt
2
3import "testing"
4
5func TestCollapsedResizeUpdatesSavedPrimaryAndClearsEscape(t *testing.T) {
6	s := NewScreen(5, 3)
7	s.Write([]byte("shell"))
8	s.Write([]byte("\x1b[?1049h"))
9	s.Write([]byte("\x1b["))
10
11	s.Resize(0, 0)
12
13	if len(s.escapeBuf) != 0 {
14		t.Fatalf("partial escape survives collapsed resize: %q", s.escapeBuf)
15	}
16	if s.frame.Width != 0 || s.frame.Height != 0 {
17		t.Fatalf("active frame = %dx%d, want 0x0", s.frame.Width, s.frame.Height)
18	}
19	s.Write([]byte("\x1b[?1049l"))
20	if s.frame.Width != 0 || s.frame.Height != 0 {
21		t.Fatalf("saved primary frame = %dx%d, want 0x0", s.frame.Width, s.frame.Height)
22	}
23}
24
25func TestResizeReflowDropsAbandonedWideEdgePadding(t *testing.T) {
26	s := NewScreen(4, 3)
27	s.Write([]byte("ab界"))
28	s.Write([]byte("\x1b[1;4H界x"))
29
30	s.Resize(6, 3)
31
32	assertCell(t, s, 0, 0, 'a')
33	assertCell(t, s, 1, 0, 'b')
34	assertCell(t, s, 2, 0, '界')
35	if !cellAt(s, 3, 0).Continuation {
36		t.Fatal("reflowed wide rune lost continuation")
37	}
38	assertCell(t, s, 4, 0, 'x')
39}
40
41func TestInsertModeRetainsShiftedTailInReflowExtent(t *testing.T) {
42	s := NewScreen(6, 2)
43	s.Write([]byte("abcd"))
44	s.Write([]byte("\x1b[1;2H\x1b[4hX"))
45	// Simulate the subsequent logical continuation that causes the row to be
46	// reflowed. Its meaningful extent must include the shifted tail.
47	s.buffer.continueRow(0)
48
49	s.Resize(5, 2)
50
51	for x, r := range []rune("aXbcd") {
52		assertCell(t, s, x, 0, r)
53	}
54}

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 2

Tags 13

↑↓ moveenter openesc close