v0.4.0 b6be3a8

fullscreen_left_test.go RawHistoryFolder

1package core
2
3import "testing"
4
5// After the user leaves a window's fullscreen for another window, the
6// client's next fullscreen request is refused until the window is focused
7// again, whichever way the user left: a focus move, an activation or the
8// overview.
9func TestLeftFullscreenRefusesRequest(t *testing.T) {
10	leaves := map[string]func(m *Monitor){
11		"focus move": func(m *Monitor) { m.Current().FocusColumn(-1) },
12		"activate":   func(m *Monitor) { m.Current().Activate(1) },
13		"overview": func(m *Monitor) {
14			m.ToggleOverview()
15			m.OverviewPick(1)
16		},
17	}
18	// Fixed overflow refuses an unfocused window's request anyway; scroll
19	// with a float is where the latch alone refuses it.
20	for _, tc := range pinnedCases {
21		for name, leave := range leaves {
22			t.Run(tc.name+"/"+name, func(t *testing.T) {
23				m := coverMonitor(tc.overflow, tc.float)
24				w := m.Current()
25				leave(m)
26				if f, _ := m.Focused(); f != 1 || w.fullscreen != 0 || w.left != 2 {
27					t.Fatalf("leave: focused %d, fullscreen %d, left %d", f, w.fullscreen, w.left)
28				}
29				m.SetFullscreen(2, true)
30				if f, _ := m.Focused(); f != 1 || w.fullscreen != 0 {
31					t.Fatalf("re-request: focused %d, fullscreen %d", f, w.fullscreen)
32				}
33				w.FocusID(2)
34				m.SetFullscreen(2, true)
35				if w.fullscreen != 2 || w.left != 0 {
36					t.Fatalf("focused again: fullscreen %d, left %d", w.fullscreen, w.left)
37				}
38			})
39		}
40	}
41}
42
43// The bind leaves a window's own fullscreen without the latch: the app
44// may ask again at once.
45func TestToggleFullscreenOffNoLatch(t *testing.T) {
46	m := coverMonitor(OverflowFixed, false)
47	w := m.Current()
48	m.ToggleFullscreen()
49	if w.fullscreen != 0 || w.left != 0 {
50		t.Fatalf("fullscreen %d, left %d", w.fullscreen, w.left)
51	}
52	m.SetFullscreen(2, true)
53	if w.fullscreen != 2 {
54		t.Fatalf("request refused: %d", w.fullscreen)
55	}
56}
57
58// Focusing the window again drops the latch even without a request, so a
59// later request while unfocused follows the usual rules again.
60func TestLeftFullscreenSettlesOnFocus(t *testing.T) {
61	m := coverMonitor(OverflowScroll, true)
62	w := m.Current()
63	w.Activate(1)
64	w.FocusID(2)
65	w.settleLeft()
66	if w.left != 0 {
67		t.Fatalf("left %d", w.left)
68	}
69	w.FocusID(1)
70	m.SetFullscreen(2, true)
71	if w.fullscreen != 2 {
72		t.Fatalf("request refused: %d", w.fullscreen)
73	}
74}
75
76// A taskbar fullscreen request activates the window first (core), so it
77// passes the latch.
78func TestLeftFullscreenTaskbar(t *testing.T) {
79	m := coverMonitor(OverflowScroll, true)
80	w := m.Current()
81	w.Activate(1)
82	w.Activate(2)
83	m.SetFullscreen(2, true)
84	if w.fullscreen != 2 || w.left != 0 {
85		t.Fatalf("fullscreen %d, left %d", w.fullscreen, w.left)
86	}
87}
88
89// A latched window moved away with its column, which another window of
90// it has the focus of, drops the latch.
91func TestLeftFullscreenColumnMoved(t *testing.T) {
92	w := cols(OverflowScroll, 2, 0, []WindowID{2, 3}, []WindowID{1})
93	w.FocusID(2)
94	w.fullscreen = 2
95	w.Activate(3)
96	if w.left != 2 {
97		t.Fatalf("latch %d", w.left)
98	}
99	if _, ok := w.takeColumn(); !ok || w.left != 0 {
100		t.Fatalf("left %d", w.left)
101	}
102}
103
104// A latched window that goes away drops the latch.
105func TestLeftFullscreenRemoved(t *testing.T) {
106	m := coverMonitor(OverflowScroll, true)
107	w := m.Current()
108	w.Activate(1)
109	w.RemoveWindow(2)
110	if w.left != 0 {
111		t.Fatalf("left %d", w.left)
112	}
113}
114
115// Activating a hidden stashed window leaves another window's fullscreen
116// with the latch too.
117func TestActivateHiddenStashLatches(t *testing.T) {
118	m := newMonitor("", "")
119	m.SetOutput(300, 200)
120	m.SetOverflow(OverflowFixed)
121	w := m.Current()
122	w.AddWindow(1)
123	w.AddWindow(5)
124	w.FocusID(5)
125	w.ToggleWindowStash()
126	w.ToggleStashVisible()
127	w.FocusID(1)
128	m.ToggleFullscreen()
129	w.Activate(5)
130	if f, _ := w.Focused(); f != 5 || w.fullscreen != 0 || w.left != 1 {
131		t.Fatalf("focused %d, fullscreen %d, left %d", f, w.fullscreen, w.left)
132	}
133}

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