overview_cascade_test.go RawHistoryFolder

1package core
2
3import (
4	"github.com/bnema/neferwl/internal/ports"
5	"testing"
6)
7
8func TestOverviewCascadeBandGeometry(t *testing.T) {
9	w := cascadeWorkspace(7)
10	tiles, p := w.previewTiles()
11	if p.bounds.W != w.Usable.W || p.bounds.H != 3*w.Usable.H {
12		t.Fatalf("bounds=%v", p.bounds)
13	}
14	for i, tile := range tiles {
15		if tile.Rect.X != w.cellX(i) || tile.Rect.Y != w.gap()+w.band(i)*w.Usable.H {
16			t.Fatalf("tile %d=%v", i, tile.Rect)
17		}
18	}
19}
20
21func TestOverviewCascadePreviewBufferAllocations(t *testing.T) {
22	w := cascadeWorkspace(7)
23	buf, _ := w.previewTiles()
24	if n := testing.AllocsPerRun(100, func() { buf, _ = w.previewTilesInto(buf[:0]) }); n != 0 {
25		t.Fatalf("allocations=%v", n)
26	}
27}
28
29func TestOverviewMixedLayoutGestureAndCancel(t *testing.T) {
30	m := overviewMonitor()
31	m.SetOverflow(OverflowFixed)
32	m.Current().Overflow = OverflowCascade
33	from := m.Current()
34	m.ToggleOverview()
35	rows, _ := m.overviewRows()
36	if rows[m.Workspaces[1]].X <= 0 {
37		t.Fatal("cascade neighbor not horizontal")
38	}
39	m.overviewScroll(ports.PointerAxis{Source: ports.AxisFinger, Horizontal: ports.ScrollAxis{Set: true, Value: overviewScrollStep}})
40	if m.Current() == from {
41		t.Fatal("horizontal gesture did not change workspace")
42	}
43	if m.Current().Overflow != OverflowFixed {
44		t.Fatal("destination lost fixed policy")
45	}
46	m.CancelOverview()
47	if m.Current() != from {
48		t.Fatal("cancel lost source workspace")
49	}
50}
51
52func TestOverviewCascadeReloadRetainsSelection(t *testing.T) {
53	m := overviewMonitor()
54	m.ToggleOverview()
55	w := m.Current()
56	id, _ := w.Focused()
57	m.SetOverflow(OverflowCascade)
58	if got, _ := w.Focused(); !m.ov.open || got != id {
59		t.Fatal("reload lost overview selection")
60	}
61	m.CancelOverview()
62	if got, _ := w.Focused(); got != id {
63		t.Fatal("cancel lost original focus")
64	}
65}
66
67func TestOverviewMixedWheelDoesNotBounce(t *testing.T) {
68	for _, source := range []ports.AxisSource{ports.AxisWheel, ports.AxisContinuous} {
69		m := overviewMonitor()
70		m.SetOverflow(OverflowFixed)
71		m.Workspaces[1].Overflow = OverflowCascade
72		m.ToggleOverview()
73		from := m.Current()
74		m.overviewScroll(ports.PointerAxis{Source: source, Vertical: ports.ScrollAxis{Set: true, Value: overviewScrollStep, V120: 120}})
75		if m.Current() == from {
76			t.Fatalf("source %v bounced", source)
77		}
78	}
79}
80
81func TestOverviewCascadeStashScale(t *testing.T) {
82	w := cascadeWorkspace(7)
83	w.Stash = []Float{{ID: 20}}
84	cards := w.pile(0, false, 0)
85	if len(cards) != 1 || cards[0].Preview != overviewCardZoom {
86		t.Fatalf("cards=%v", cards)
87	}
88	if w.pileWidth() > w.overviewArea().W/3 {
89		t.Fatal("stash exceeds width budget")
90	}
91}

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 26

Tags 10

↑↓ moveenter openesc close