v0.3.0 99dc266

theme_resolve.go RawHistoryFolder

1package daemon
2
3import "github.com/bnema/vev/internal/usecase/theme"
4
5func (d *Daemon) applyHostTheme(sess *session, ac *attachedClient, t theme.Theme, clearUnknownScheme bool) bool {
6	if ac != nil {
7		ac.sendMu.Lock()
8		defer ac.sendMu.Unlock()
9	}
10	sess.themeMu.Lock()
11	defer sess.themeMu.Unlock()
12	return d.applyHostThemeLocked(sess, ac, t, clearUnknownScheme)
13}
14
15func (d *Daemon) applyHostThemeLocked(sess *session, ac *attachedClient, t theme.Theme, clearUnknownScheme bool) bool {
16	// Resolve while applying, never while composing. The theme mutex only
17	// publishes the completed value and is not held across session/tab/pane
18	// locks, preserving the daemon lock order.
19	applied := d.resolveAppliedTheme(t)
20	t = applied.Raw
21	sess.mu.Lock()
22	if ac != nil {
23		if _, attached := sess.attachments[ac]; !attached {
24			sess.mu.Unlock()
25			return false
26		}
27	}
28	tabs := append([]*tab(nil), sess.tabs...)
29	sess.mu.Unlock()
30
31	if ac != nil {
32		ac.setAppliedTheme(applied)
33	}
34	for _, tb := range tabs {
35		tb.mu.Lock()
36		panes := tb.panesSnapshot()
37		if floating := tb.floating.pane; floating != nil {
38			panes = append(panes, floating)
39		}
40		tb.mu.Unlock()
41		for _, p := range panes {
42			p.mu.Lock()
43			applyPaneThemeLocked(p, t, clearUnknownScheme)
44			p.mu.Unlock()
45		}
46	}
47	return true
48}
49
50func applyPaneThemeLocked(p *pane, t theme.Theme, clearUnknownScheme bool) {
51	p.screen.SetDefaultColors(t.Foreground, t.Background, t.HasFG && t.HasBG)
52	if t.SchemeKnown {
53		p.screen.SetColorScheme(t.Light)
54	} else if clearUnknownScheme {
55		p.screen.ClearColorScheme()
56	}
57}

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 12

Tags 11

↑↓ moveenter openesc close