v0.10.0 d5d679d

hintoptin_test.go RawHistoryFolder

1package app
2
3import (
4	"context"
5	"runtime"
6	"testing"
7	"time"
8
9	"github.com/stretchr/testify/require"
10
11	"github.com/bnema/neferwl/internal/adapters/clock"
12	"github.com/bnema/neferwl/internal/adapters/config"
13	"github.com/bnema/neferwl/internal/adapters/logging"
14	"github.com/bnema/neferwl/internal/adapters/xkb"
15	"github.com/bnema/neferwl/internal/ports"
16)
17
18func TestHintPipesOffByDefault(t *testing.T) {
19	require.False(t, config.Defaults().Hint.Enable)
20	off := newPipes(false, false)
21	require.Nil(t, off.hintScans)
22	require.Nil(t, off.hintResults)
23	require.Nil(t, off.hintCaptured)
24	// No demultiplexing: the outputs reply on the wayland channel itself.
25	require.Equal(t, off.captured, off.capturedAll)
26	ch := off.core()
27	require.Nil(t, ch.HintScans)
28	require.Nil(t, ch.Hints)
29	on := newPipes(false, true)
30	require.NotNil(t, on.hintScans)
31	require.NotNil(t, on.hintResults)
32	require.NotNil(t, on.hintCaptured)
33	require.NotEqual(t, on.captured, on.capturedAll)
34}
35
36func TestHintOffStartsNoHintGoroutine(t *testing.T) {
37	t.Setenv("XDG_RUNTIME_DIR", t.TempDir())
38	ctx, cancel := context.WithCancel(context.Background())
39	defer cancel()
40	done := make(chan error, 1)
41	go func() {
42		done <- Run(ctx, Options{Backend: "headless", NoXwayland: true, Config: config.Defaults(), NoTerminal: true, Timeout: 800 * time.Millisecond})
43	}()
44	time.Sleep(400 * time.Millisecond)
45	buf := make([]byte, 1<<20)
46	dump := string(buf[:runtime.Stack(buf, true)])
47	require.NotContains(t, dump, "adapters/hints.")
48	require.NotContains(t, dump, "adapters/atspi.")
49	require.NotContains(t, dump, "routeCaptured")
50	select {
51	case <-done:
52	case <-time.After(3 * time.Second):
53		t.Fatal("session did not stop")
54	}
55}
56
57func TestRelayConfigKeepsStartupHintEnable(t *testing.T) {
58	ctx, cancel := context.WithCancel(context.Background())
59	defer cancel()
60	cur := config.Defaults()
61	in := make(chan ports.ConfigChanged, 1)
62	out := make(chan ports.ConfigChanged, 1)
63	go relayConfig(ctx, cur, in, out, make(chan *xkb.Keymap, 1), make(chan ports.InputDevicesConfig, 1), newCursors(clock.System{}, 0), make(chan ports.ClientCommand, 1), logging.For(ctx, "config"))
64	next := config.Defaults()
65	next.Hint.Enable = true
66	in <- ports.ConfigChanged{Config: next}
67	require.False(t, (<-out).Config.Hint.Enable)
68}

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 23

Tags 10

↑↓ moveenter openesc close