runtime_env_test.go RawHistoryFolder

1package bootstrap
2
3import (
4	"bytes"
5	"testing"
6
7	"github.com/stretchr/testify/assert"
8)
9
10func TestApplyGTKIMModuleFallback(t *testing.T) {
11	tests := []struct {
12		name            string
13		gtkIMModule     string
14		xdgSessionType  string
15		waylandDisplay  string
16		wantEnvSet      bool
17		wantMessageSent bool
18	}{
19		{
20			name:            "GTK_IM_MODULE already set => no override, no message",
21			gtkIMModule:     "ibus",
22			xdgSessionType:  "wayland",
23			waylandDisplay:  "",
24			wantEnvSet:      false,
25			wantMessageSent: false,
26		},
27		{
28			name:            "non-Wayland with GTK_IM_MODULE unset => no override, no message",
29			gtkIMModule:     "",
30			xdgSessionType:  "x11",
31			waylandDisplay:  "",
32			wantEnvSet:      false,
33			wantMessageSent: false,
34		},
35		{
36			name:            "Wayland via XDG_SESSION_TYPE with GTK_IM_MODULE unset => override + message",
37			gtkIMModule:     "",
38			xdgSessionType:  "wayland",
39			waylandDisplay:  "",
40			wantEnvSet:      true,
41			wantMessageSent: true,
42		},
43		{
44			name:            "Wayland via WAYLAND_DISPLAY with GTK_IM_MODULE unset => override + message",
45			gtkIMModule:     "",
46			xdgSessionType:  "",
47			waylandDisplay:  "wayland-0",
48			wantEnvSet:      true,
49			wantMessageSent: true,
50		},
51	}
52
53	for _, tt := range tests {
54		t.Run(tt.name, func(t *testing.T) {
55			var stderr bytes.Buffer
56			env := map[string]string{
57				"GTK_IM_MODULE":    tt.gtkIMModule,
58				"XDG_SESSION_TYPE": tt.xdgSessionType,
59				"WAYLAND_DISPLAY":  tt.waylandDisplay,
60			}
61			getter := func(key string) string { return env[key] }
62			var setKey, setValue string
63			setter := func(key, val string) error {
64				setKey = key
65				setValue = val
66				return nil
67			}
68
69			ApplyGTKIMModuleFallback(&stderr, getter, setter)
70
71			msg := stderr.String()
72			if tt.wantMessageSent {
73				assert.Contains(t, msg, "GTK_IM_MODULE unset", "expected stderr message")
74				assert.Equal(t, "GTK_IM_MODULE", setKey)
75				assert.Equal(t, "gtk-im-context-simple", setValue)
76			} else {
77				assert.Empty(t, msg, "expected no stderr message")
78				assert.Empty(t, setKey, "expected no env var set")
79			}
80		})
81	}
82}

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 8

Tags 42

↑↓ moveenter openesc close