scene_seq_test.go RawHistoryFolder

1package core_test
2
3import (
4	"testing"
5
6	"github.com/bnema/neferwl/internal/ports"
7)
8
9// A publish that changes nothing on an output keeps that output's Seq, so
10// its owner does not recompose; a real change takes a new one.
11func TestSceneSeqKeptWhenNothingChanged(t *testing.T) {
12	r := startSwipe(t, nil)
13	first := r.mapWindow(t, 1)[0]
14	if first.Seq == 0 {
15		t.Fatal("scene without Seq")
16	}
17	// Focus-column-left at the left edge changes nothing but still publishes.
18	again := r.key(t, "Left", ports.ModAlt)[0]
19	if again.Seq != first.Seq || !again.SameAs(first) {
20		t.Fatalf("Seq %d, want the held %d", again.Seq, first.Seq)
21	}
22	next := r.mapWindow(t, 2)[0]
23	if next.Seq <= first.Seq || len(next.Windows) != 2 {
24		t.Fatalf("Seq %d after mapping a window (was %d), %d windows", next.Seq, first.Seq, len(next.Windows))
25	}
26}
27
28// A key that starts a transition can publish a scene that draws what the
29// previous one did (the springs start there): it still gets a fresh Seq, or
30// the outputs would drop it and the motion would wait for the fallback timer
31// to begin.
32func TestAnimatingKeyGetsFreshSeq(t *testing.T) {
33	tests := []struct {
34		name string
35		edit func(*ports.Config)
36		// setup returns the scene before the key.
37		setup func(*testing.T, *swipeRig) ports.Scene
38		sym   string
39		mods  ports.Mods
40		// same: the key's scene draws what the previous one did.
41		same bool
42	}{
43		{"width change", func(c *ports.Config) {
44			c.Layout.MaxColumns = 4
45			c.Binds["Cmd+Ctrl+Right"] = "set-column-width +1"
46		},
47			func(t *testing.T, r *swipeRig) ports.Scene {
48				twoColumns(t, r)
49				return r.key(t, "Left", ports.ModAlt)[0]
50			}, "Right", ports.ModAlt | ports.ModCtrl, true},
51		{"focus scroll", nil, func(t *testing.T, r *swipeRig) ports.Scene {
52			threeColumns(t, r)
53			return r.key(t, "Left", ports.ModAlt)[0] // 2 is on screen: no scroll
54		}, "Left", ports.ModAlt, false},
55	}
56	for _, tt := range tests {
57		t.Run(tt.name, func(t *testing.T) {
58			r := startSwipe(t, tt.edit)
59			prev := tt.setup(t, r)
60			s := r.key(t, tt.sym, tt.mods)[0]
61			if s.SameAs(prev) != tt.same {
62				t.Fatalf("scene right after the key same as the previous one: %t, want %t", s.SameAs(prev), tt.same)
63			}
64			if s.Seq <= prev.Seq {
65				t.Fatalf("Seq %d right after the key, want a new one (was %d)", s.Seq, prev.Seq)
66			}
67		})
68	}
69}
70
71// A key that animates nothing keeps its output's Seq.
72func TestNoOpKeyKeepsSeqWithAnimationsOn(t *testing.T) {
73	r := startSwipe(t, nil)
74	threeColumns(t, r)
75	first := r.key(t, "Right", ports.ModAlt)[0] // 3 is the last column
76	for range 2 {
77		if s := r.key(t, "Right", ports.ModAlt)[0]; s.Seq != first.Seq || !s.SameAs(first) {
78			t.Fatalf("Seq %d on a key at the edge, want the held %d", s.Seq, first.Seq)
79		}
80	}
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