feat/data-dnd e05cb15

cascade_edges_test.go RawHistoryFolder

1package core
2
3import "testing"
4
5// With no monitor on that side, move-column-left/right at a cascade band
6// edge does nothing: the column never crosses into the adjacent band.
7// Bands {1 2 3} {4 5}.
8func TestCascadeMoveColumnAtBandEdgeDoesNothing(t *testing.T) {
9	for _, tc := range []struct {
10		name   string
11		from   WindowID
12		action Action
13	}{
14		{"right from band end", 3, ActionMoveColumnRight},
15		{"left from band start", 4, ActionMoveColumnLeft},
16		{"left from first column", 1, ActionMoveColumnLeft},
17		{"right from last column", 5, ActionMoveColumnRight},
18	} {
19		t.Run(tc.name, func(t *testing.T) {
20			c, w := cascadeMovesCore(t, 5, 3, false)
21			w.FocusID(tc.from)
22			c.applyAction(tc.action)
23			wantColumns(t, w, 1, 2, 3, 4, 5)
24			wantFocus(t, c, "M", tc.from)
25			wantActive(t, c.cur().mon, 0)
26		})
27	}
28}
29
30// Inside a band the column still swaps with its neighbor.
31func TestCascadeMoveColumnInsideBandSwaps(t *testing.T) {
32	c, w := cascadeMovesCore(t, 5, 3, false)
33	w.FocusID(2)
34	c.applyAction(ActionMoveColumnRight)
35	wantColumns(t, w, 1, 3, 2, 4, 5)
36	wantFocus(t, c, "M", 2)
37	c.applyAction(ActionMoveColumnRight)
38	wantColumns(t, w, 1, 3, 2, 4, 5)
39	c.applyAction(ActionMoveColumnLeft)
40	c.applyAction(ActionMoveColumnLeft)
41	wantColumns(t, w, 2, 1, 3, 4, 5)
42	c.applyAction(ActionMoveColumnLeft)
43	wantColumns(t, w, 2, 1, 3, 4, 5)
44}
45
46// A neighbor monitor on the left screen's right side wins over an occupied
47// workspace there: focus-column-right at the band edge goes to the screen.
48func TestCascadeFocusColumnEdgePrefersMonitorOverWorkspace(t *testing.T) {
49	c := layoutCore(0, tile{"L", 0, 0, 900, 600}, tile{"R", 900, 0, 900, 600})
50	m := c.cur().mon
51	m.SetOverflow(OverflowCascade)
52	m.SetMaxColumns(3)
53	m.AddWindow(1)
54	m.AddWindow(2)
55	m.Focus(1)
56	m.AddWindow(3) // an occupied workspace to the right on L
57	m.Focus(0)
58	m.normalize()
59	m.Current().FocusID(2)
60	c.applyAction(ActionFocusColumnRight)
61	wantFocus(t, c, "R", 0)
62	wantActive(t, m, 0)
63}
64
65// With no monitor on that side, the occupied neighbor workspace is next.
66func TestCascadeFocusColumnEdgeSwitchesToOccupiedWorkspace(t *testing.T) {
67	c := layoutCore(0, tile{"M", 0, 0, 900, 600})
68	m := c.cur().mon
69	m.SetOverflow(OverflowCascade)
70	m.SetMaxColumns(3)
71	m.AddWindow(1)
72	m.AddWindow(2)
73	m.Focus(1)
74	m.AddWindow(3)
75	m.Focus(0)
76	m.normalize()
77	m.Current().FocusID(2)
78	c.applyAction(ActionFocusColumnRight)
79	wantActive(t, m, 1)
80	wantFocus(t, c, "M", 3)
81}

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