v0.7.0 36c429d

cell_test.go RawHistoryFolder

1package core
2
3import "testing"
4
5func TestBlankCellIsSpaceWithDefaultStyle(t *testing.T) {
6	want := Cell{Rune: ' ', Style: DefaultStyle()}
7	if got := BlankCell(); got != want {
8		t.Fatalf("BlankCell() = %+v, want %+v", got, want)
9	}
10	if BlankCell() == (Cell{}) {
11		t.Fatal("blank cell unexpectedly equals the zero Cell")
12	}
13}
14
15func TestCellEqualUsesSemanticStyleEquality(t *testing.T) {
16	leftStyle := Style{
17		Foreground:        7,
18		HasForegroundRGB:  true,
19		ForegroundRGB:     RGB{R: 1, G: 2, B: 3},
20		Background:        -1,
21		BackgroundRGB:     RGB{R: 4, G: 5, B: 6},
22		UnderlineColor:    9,
23		UnderlineColorRGB: RGB{R: 7, G: 8, B: 9},
24	}
25	rightStyle := leftStyle
26	rightStyle.Foreground = 99
27	rightStyle.BackgroundRGB = RGB{R: 10, G: 11, B: 12}
28	rightStyle.UnderlineColor = 42
29
30	left := Cell{Rune: 'x', Style: leftStyle}
31	right := Cell{Rune: 'x', Style: rightStyle}
32	if !left.Equal(right) {
33		t.Fatal("cells with equal active style fields must compare equal")
34	}
35	if left == right {
36		t.Fatal("fixture must differ in inactive raw style fields")
37	}
38}
39
40func TestCellEqualIncludesPayload(t *testing.T) {
41	payload, err := NewCellPayload("e\u0301", "https://example.com")
42	if err != nil {
43		t.Fatal(err)
44	}
45	plain := Cell{Rune: 'e', Style: DefaultStyle()}
46	rich := plain
47	rich.Payload = payload
48	if plain.Equal(rich) || rich.Equal(plain) {
49		t.Fatal("different payloads must not compare equal")
50	}
51	if !rich.Equal(rich) {
52		t.Fatal("payload cell must equal itself")
53	}
54}
55
56func TestContinuationCellSemanticsRemainExplicit(t *testing.T) {
57	style := DefaultStyle()
58	head := Cell{Rune: '界', Style: style}
59	tail := Cell{Style: style, Continuation: true}
60	if head.Continuation || head.Rune != '界' {
61		t.Fatalf("wide head = %+v", head)
62	}
63	if !tail.Continuation || tail.Rune != 0 {
64		t.Fatalf("wide tail = %+v", tail)
65	}
66	if head.Equal(tail) {
67		t.Fatal("wide head and continuation tail unexpectedly compare equal")
68	}
69}

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