v0.2.0 13c6a90

windows_test.go RawHistoryFolder

1package core
2
3import (
4	"testing"
5	"time"
6
7	"github.com/bnema/neferwl/internal/ports"
8)
9
10func TestWindowRegistryDropForgetsEverything(t *testing.T) {
11	r := newWindowRegistry()
12	now := time.Unix(10, 0)
13	r.mapped(ports.WindowMapped{ID: 1, AppID: "a", PID: 7}, now)
14	r.setAppID(1, "b")
15	r.setRegion(ports.InputRegionChanged{ID: 1, Rects: []ports.Rect{{W: 1, H: 1}}})
16	r.setInhibitShortcuts(1, true)
17	r.setIdleInhibit(1, true)
18	rec := r.lookup(1)
19	if rec.client.AppID != "b" || rec.client.PID != 7 || !rec.mappedAt.Equal(now) || !rec.inhibitShortcuts || !rec.idleInhibit {
20		t.Fatalf("record = %+v", rec)
21	}
22	if r.acceptsInput(1, 5, 5) {
23		t.Fatal("point outside the region accepted")
24	}
25	r.drop(1)
26	if len(r.records) != 0 {
27		t.Fatalf("records left after drop: %v", r.records)
28	}
29	if !r.acceptsInput(1, 5, 5) {
30		t.Fatal("dropped window keeps its region")
31	}
32}
33
34func TestWindowRegistryAppIDNeedsMap(t *testing.T) {
35	r := newWindowRegistry()
36	r.setIdleInhibit(1, true)
37	r.setAppID(1, "a")
38	if got := r.lookup(1).client.AppID; got != "" {
39		t.Fatalf("unmapped window got app ID %q", got)
40	}
41}
42
43func TestWindowRegistryLayerGone(t *testing.T) {
44	r := newWindowRegistry()
45	r.setRegion(ports.InputRegionChanged{ID: 2, Rects: []ports.Rect{{W: 1, H: 1}}})
46	r.setRegion(ports.InputRegionChanged{ID: 3, Rects: []ports.Rect{{W: 1, H: 1}}})
47	r.setIdleInhibit(3, true)
48	r.layerGone(2)
49	r.layerGone(3)
50	if _, ok := r.records[2]; ok {
51		t.Fatal("empty layer record kept")
52	}
53	if rec := r.records[3]; rec == nil || rec.region != nil || !rec.idleInhibit {
54		t.Fatalf("layer 3 record = %+v", rec)
55	}
56	// Turning off an unknown surface creates nothing.
57	r.setInhibitShortcuts(4, false)
58	r.setIdleInhibit(4, false)
59	if _, ok := r.records[4]; ok {
60		t.Fatal("record created on release")
61	}
62}

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