v0.33.2 57f21d6

defaults_test.go RawHistoryFolder

1package config
2
3import (
4	"testing"
5
6	"github.com/stretchr/testify/assert"
7	"github.com/stretchr/testify/require"
8)
9
10func TestDefaultConfig_CoreDefaults(t *testing.T) {
11	cfg := DefaultConfig()
12	assert.Equal(t, "info", cfg.Logging.Level)
13	assert.Equal(t, defaultMaxLogFiles, cfg.Logging.MaxFiles)
14	assert.False(t, cfg.Logging.CaptureGTKLogs)
15	assert.False(t, cfg.Media.ShowDiagnosticsOnStartup)
16	assert.Equal(t, ExternalLinkBehaviorWindowed, cfg.Workspace.ExternalLinks.Behavior)
17	assert.Equal(t, ExternalLinkPlacementRight, cfg.Workspace.ExternalLinks.Placement)
18	assert.Equal(t, "delay", cfg.Workspace.Styling.ModeLegend)
19	assert.Equal(t, 500, cfg.Workspace.Styling.ModeLegendDelayMs)
20	assert.True(t, cfg.Workspace.Styling.ModeLegendAnimations)
21	assert.True(t, cfg.Workspace.Styling.ModeLegendLinger)
22	assert.False(t, cfg.Workspace.Styling.ModeLegendCollapsed)
23	assert.Equal(t, "#F7768E", cfg.Workspace.Styling.VimModeColor)
24
25	// Engine defaults (replaces old Performance/Privacy sections)
26	assert.Equal(t, EngineTypeCEF, cfg.Engine.Type)
27	assert.Equal(t, ProfileDefault, cfg.Engine.Profile)
28	assert.Equal(t, CookiePolicyAlways, cfg.Engine.CookiePolicy)
29	assert.Equal(t, CEFRenderStackVulkan, cfg.Engine.CEF.CEFRenderStack())
30	assert.True(t, cfg.Engine.CEF.CEFAdaptiveWindowlessFrameRate())
31	assert.Equal(t, int32(defaultCEFWindowlessFrameRate), cfg.Engine.CEF.CEFWindowlessFrameRate())
32	assert.Equal(t, int32(defaultCEFWindowlessFrameRateMax), cfg.Engine.CEF.CEFWindowlessFrameRateMax())
33	assert.Empty(t, cfg.Engine.CEF.LogFile)
34	assert.True(t, cfg.Engine.CEF.EnableAudioHandler)
35	assert.False(t, cfg.Engine.CEF.TraceHandlers)
36	assert.InDelta(t, defaultCEFScrollMultiplier, cfg.Engine.CEF.Input.ScrollWheelMultiplier, 0.001)
37	assert.InDelta(t, defaultCEFScrollPreciseMultiplier, cfg.Engine.CEF.Input.ScrollPreciseMultiplier, 0.001)
38	assert.InDelta(t, defaultCEFScrollMultiplier, cfg.Engine.CEF.Input.ScrollHorizontalMultiplier, 0.001)
39	assert.InDelta(t, defaultCEFScrollMultiplier, cfg.Engine.CEF.Input.ScrollVerticalMultiplier, 0.001)
40	assert.Equal(t, int32(defaultCEFScrollMaxDelta), cfg.Engine.CEF.Input.ScrollMaxDelta)
41	assert.Equal(t, defaultCEFTouchpadNavigation, cfg.Engine.CEF.Input.TouchpadNavigationEnabled)
42	assert.InDelta(t, defaultCEFTouchpadNavigationDelta, cfg.Engine.CEF.Input.TouchpadNavigationMinDelta, 0.001)
43	assert.InDelta(t, defaultCEFTouchpadNavigationRatio, cfg.Engine.CEF.Input.TouchpadNavigationMaxVerticalRatio, 0.001)
44	assert.True(t, cfg.Engine.WebKit.ITPEnabled)
45
46	// Pane mode actions.
47	requireActionBinding(t, cfg.Workspace.PaneMode.Actions, "eject-pane-to-window", []string{"w"})
48	assert.Equal(t, "Eject active pane to a new window", cfg.Workspace.PaneMode.Actions["eject-pane-to-window"].Desc)
49
50	// System view shortcuts are first-class global actions.
51	requireActionBinding(t, cfg.Workspace.Shortcuts.Actions, "toggle-history-systemview", []string{"ctrl+h"})
52	requireActionBinding(t, cfg.Workspace.Shortcuts.Actions, "toggle-favorites-sidebar", []string{"ctrl+b"})
53	requireActionBinding(t, cfg.Workspace.Shortcuts.Actions, "toggle-current-page-favorite", []string{"ctrl+d"})
54	requireActionBinding(t, cfg.Workspace.Shortcuts.Actions, "toggle-config-systemview", []string{})
55
56	// Old sections (Rendering, Privacy, Performance, Runtime) have been removed from Config.
57	// Their values now live under cfg.Engine / cfg.Engine.WebKit (validated above).
58}
59
60func requireActionBinding(t *testing.T, actions map[string]ActionBinding, action string, keys []string) {
61	t.Helper()
62	binding, ok := actions[action]
63	require.True(t, ok, "missing action binding %q", action)
64	if len(keys) == 0 {
65		assert.Empty(t, binding.Keys)
66		return
67	}
68	assert.Equal(t, keys, binding.Keys)
69}

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