feat/data-dnd e05cb15

animate_alloc_test.go RawHistoryFolder

1package core
2
3import (
4	"testing"
5	"time"
6)
7
8// TestAnimateAllocations guards animate: with a camera, a switch and 20 rect
9// motions running (fade, dim and scale components, half of them leaving) it
10// allocates nothing.
11func TestAnimateAllocations(t *testing.T) {
12	c, ic := indicatorCore(t)
13	c.cfg.Animations.On = true
14	sc := c.cur()
15	t0 := ic.now
16	m := sc.mon
17	m.AddWindow(1)
18	m.AddWindow(2)
19
20	ws := m.Workspaces[0]
21	ws.view.motion = c.spring(viewSpring(100, 0), t0)
22	ws.view.off = 100
23	m.switchView.motion = c.spring(workspaceSpring(100, 0), t0)
24	m.switchView.off = 100
25	ws.stashView.motion = c.spring(workspaceSpring(0.5, 0), t0)
26	ws.stashView.off = 0.5
27	sc.rects = make(map[WindowID]rectMotion, 20)
28	for i := range 20 {
29		sp := viewSpring(50, 0)
30		rm := rectMotion{
31			x: c.spring(sp, t0), y: c.spring(sp, t0),
32			w: c.spring(sp, t0), h: c.spring(sp, t0),
33			dx: 50, dy: 50, dw: 50, dh: 50,
34			fade: c.spring(levelSpring(1, 0), t0), df: 1,
35			dim: c.spring(levelSpring(0.5, 0), t0), ddim: 0.5,
36			scale: true,
37		}
38		if i%2 == 0 {
39			rm.leaving, rm.left = true, Placement{ID: WindowID(100 + i), Rect: Rect{W: 10, H: 10}}
40		}
41		sc.rects[WindowID(100+i)] = rm
42	}
43
44	// A stash peek's veil moves alone (a navigation): dim-only motions,
45	// some going below zero, as an offset from Stash.Dim.
46	for i := range 4 {
47		var rm rectMotion
48		from := 0.5
49		if i%2 == 1 {
50			from = -0.5
51		}
52		rm.dim, rm.ddim = c.spring(levelSpring(from, 0), t0), from
53		sc.rects[WindowID(200+i)] = rm
54	}
55
56	now := t0.Add(10 * time.Millisecond)
57	for name, only := range map[string]*screen{"all": nil, "only": sc} {
58		if n := testing.AllocsPerRun(100, func() { c.animate(now, only) }); n != 0 {
59			t.Errorf("animate(%s) allocs = %v, want 0", name, n)
60		}
61	}
62	if !ws.view.motion.on || !ws.stashView.motion.on || !m.switchView.motion.on || len(sc.rects) != 24 {
63		t.Fatalf("motions settled: camera %v switch %v rects %d", ws.view.motion.on, m.switchView.motion.on, len(sc.rects))
64	}
65}

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