v0.3.0 0a8834d

worker_test.go RawHistoryFolder

1package visual
2
3import (
4	"bytes"
5	"errors"
6	"testing"
7	"time"
8
9	"github.com/bnema/zerowrap"
10	"github.com/stretchr/testify/require"
11)
12
13func TestWorkerEnvironmentIsAnAllowlistOfPresentVariables(t *testing.T) {
14	host := map[string]string{
15		"HOME": "/home/u", "PATH": "/usr/bin", "USER": "u", "GNUPGHOME": "/g", "GPG_TTY": "/dev/pts/1",
16		"WAYLAND_DISPLAY": "wayland-1", "SSH_AUTH_SOCK": "/s", "NEFERAFK_PIN": "123456", "LC_ALL": "",
17	}
18	env := workerEnvironment(func(k string) (string, bool) { v, ok := host[k]; return v, ok })
19	require.Equal(t, []string{"HOME=/home/u", "PATH=/usr/bin", "USER=u", "LC_ALL=", "GNUPGHOME=/g", "GPG_TTY=/dev/pts/1"}, env)
20	for _, e := range env {
21		require.NotContains(t, e, "WAYLAND")
22		require.NotContains(t, e, "SSH_")
23		require.NotContains(t, e, "PIN")
24	}
25	require.Empty(t, workerEnvironment(func(string) (string, bool) { return "", false }))
26}
27
28func TestLockConfigReportsSkippedOutputWithComponent(t *testing.T) {
29	var buf bytes.Buffer
30	log := zerowrap.New(zerowrap.Config{Output: &buf})
31	ctl := newAuthController(testLog(), nil, boot(), time.Minute)
32	cfg := lockConfig(log, ctl, nil, make(chan struct{}, 1))
33	require.NotNil(t, cfg.OnOutputError)
34	cfg.OnOutputError("HDMI-A-1", errors.New("surface failed"))
35	out := buf.String()
36	require.Contains(t, out, "visual-lock")
37	require.Contains(t, out, "HDMI-A-1")
38	require.Contains(t, out, "surface failed")
39	require.Contains(t, out, "WRN")
40}

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 2

Tags 9

↑↓ moveenter openesc close