v0.2.0 13c6a90

float_review_regression_test.go RawHistoryFolder

1package core
2
3import "testing"
4
5func TestFullscreenFloatReturnPreservesDialogFocus(t *testing.T) {
6	for _, covering := range []bool{false, true} {
7		m := monitor()
8		m.SetOverflow(OverflowFixed)
9		m.AddWindow(1)
10		size := 30
11		if covering {
12			size = 100
13		}
14		m.AddFloating(2, size, size)
15		w := m.Current()
16		if covering {
17			w.FocusID(1)
18		}
19		m.SetFullscreen(2, true)
20		m.show(w)
21		m.AddFloating(3, 20, 20)
22		m.SetFullscreen(2, false)
23		if id, _ := w.Focused(); id != 3 || !w.floatFocus || w.Floats[len(w.Floats)-1].ID != 3 {
24			t.Fatalf("covering %v: focus %d, float focus %v, floats %+v", covering, id, w.floatFocus, w.Floats)
25		}
26	}
27}
28
29func TestDemotedFloatFullscreenUserReturn(t *testing.T) {
30	m := monitor()
31	m.SetOverflow(OverflowFixed)
32	m.AddWindow(1)
33	m.AddFloating(2, 100, 80)
34	w := m.Current()
35	w.FocusID(2)
36	m.SetFullscreen(2, true)
37	w.focusCover()
38	m.SetFullscreen(2, false)
39	if id, _ := w.Focused(); id != 2 || !w.floatFocus || w.Floats[0].below {
40		t.Fatalf("returned focus %d floats %+v", id, w.Floats)
41	}
42}
43
44func TestSetNamedDemotedFloatKeepsColumnActions(t *testing.T) {
45	m := monitor()
46	m.SetNamed([]NamedWorkspace{{Name: "work"}})
47	m.AddWindow(1)
48	m.AddFloating(2, 100, 80)
49	m.Current().FocusID(1)
50	m.SetNamed(nil)
51	w := m.Current()
52	if id, _ := w.Focused(); id != 1 || w.onFloat() || w.floatFocus {
53		t.Fatalf("focus %d float focus %v floats %+v", id, w.floatFocus, w.Floats)
54	}
55	w.ToggleFullWidth()
56	if !w.Columns[w.Focus].FullWidth {
57		t.Fatal("column action was blocked")
58	}
59}
60
61func TestFloatOnlyWorkspaceDirectionalExit(t *testing.T) {
62	for _, dir := range []int{-1, 1} {
63		m := monitor()
64		m.AddWindow(1)
65		m.Focus(1)
66		m.AddFloating(2, 20, 20)
67		m.Focus(2)
68		m.AddWindow(3)
69		m.Focus(1)
70		a := ActionFocusWindowUp
71		if dir > 0 {
72			a = ActionFocusWindowDown
73		}
74		m.Apply(a)
75		if m.Active != 1+dir {
76			t.Fatalf("direction %d stayed on workspace %d", dir, m.Active)
77		}
78	}
79}
80
81func TestOverviewMaximizedPreviewAfterAnchorRemoval(t *testing.T) {
82	m := maximizedOverview()
83	w := m.Current()
84	w.Columns[1].Windows = append(w.Columns[1].Windows, 5)
85	// Closing the maximization anchor leaves the surviving column maximized.
86	w.RemoveWindow(2)
87	m.ToggleOverview()
88	p := previewOf(t, m.Layout(), 5)
89	if p.Hidden || p.Preview <= 0 {
90		t.Fatalf("preview %+v", p)
91	}
92	real := previewOf(t, w.Layout(), 5)
93	if p.Rect.W != int(float64(real.Rect.W)*p.Preview+0.5) || p.Rect.H != int(float64(real.Rect.H)*p.Preview+0.5) {
94		t.Fatalf("preview %+v real %+v", p, real)
95	}
96}
97
98func TestOverviewPickStackedColumnWindow(t *testing.T) {
99	for _, hidden := range []bool{false, true} {
100		m := maximizedOverview()
101		w := m.Current()
102		i := w.Focus
103		if hidden {
104			i = 2
105		}
106		w.Columns[i].Windows = append(w.Columns[i].Windows, 6)
107		m.ToggleOverview()
108		m.OverviewPick(6)
109		if id, _ := w.Focused(); id != 6 || m.ov.open {
110			t.Fatalf("hidden %v: picked focus %d, overview %v", hidden, id, m.ov.open)
111		}
112	}
113}
114
115func TestOverviewTargetAfterColumnActivation(t *testing.T) {
116	for _, maximized := range []bool{false, true} {
117		m := overviewMonitor()
118		w := m.Current()
119		w.AddWindow(5)
120		w.ConsumeOrExpel(-1)
121		w.FocusID(3)
122		if maximized {
123			m.SetOverflow(OverflowFixed)
124			w.ToggleFullWidth()
125		}
126		m.ToggleOverview()
127		if maximized && w.stack()[0].kind != stackColumn {
128			t.Fatalf("expected maximized column card: %+v", w.stack())
129		}
130		w.Activate(5)
131		var highlighted WindowID
132		for _, p := range m.Layout() {
133			if p.Focused && !p.Hidden {
134				highlighted = p.ID
135			}
136		}
137		if highlighted == 0 || m.overviewTarget() != highlighted || m.Apply(ActionCloseWindow).Close != highlighted {
138			t.Fatalf("maximized %v: highlight %d target %d", maximized, highlighted, m.overviewTarget())
139		}
140		m.ToggleOverview()
141		if id, _ := w.Focused(); id != highlighted {
142			t.Fatalf("accepted %d want %d", id, highlighted)
143		}
144	}
145}

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 25

Tags 10

↑↓ moveenter openesc close