feat/hints a471fa4

modal_test.go RawHistoryFolder

1package core
2
3import "testing"
4
5// A modal dialog takes the focus its parent gets from the user: a click,
6// an activation or a focus move onto the parent. A move away from the
7// dialog reaches the parent once, and the next one goes on.
8func TestModalDialogTakesParentFocus(t *testing.T) {
9	w := workspace()
10	w.AddWindow(1)
11	w.AddWindow(2)
12	w.AddDialog(3, 1, 20, 10)
13	w.SetModal(3, true)
14	focus := func(want WindowID) {
15		t.Helper()
16		if id, _ := w.Focused(); id != want {
17			t.Fatalf("focus %d, want %d", id, want)
18		}
19	}
20	focus(3)
21	w.Click(2)
22	focus(2)
23	w.Click(1)
24	focus(3)
25	w.Click(2)
26	w.Activate(1)
27	focus(3)
28	// Away from the dialog: the parent, then on.
29	w.FocusColumn(-1)
30	focus(1)
31	// A move that goes nowhere (the left edge) leaves it there.
32	w.FocusColumn(-1)
33	focus(1)
34	w.FocusColumn(1)
35	focus(2)
36	// Back onto the parent from elsewhere: the dialog.
37	w.FocusColumn(-1)
38	focus(3)
39
40	// Not modal: the parent keeps the focus it gets.
41	w.SetModal(3, false)
42	w.Click(1)
43	focus(1)
44	// Turning modal is a client request: it moves no focus, the next
45	// user focus on the parent does.
46	w.SetModal(3, true)
47	focus(1)
48	w.Click(2)
49	w.Click(1)
50	focus(3)
51	// A modal dialog of the dialog blocks both.
52	w.AddDialog(4, 3, 10, 5)
53	w.SetModal(4, true)
54	w.Click(2)
55	w.Click(1)
56	focus(4)
57	w.RemoveWindow(4)
58	// Picking the parent's card in the overview is a user focus too.
59	w.Click(2)
60	w.apply(stackItem{kind: stackColumns}, 1)
61	focus(3)
62	// Closed: the parent is reachable again.
63	w.RemoveWindow(3)
64	w.Click(2)
65	w.Click(1)
66	focus(1)
67}

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