v0.2.0 80c61e3

recent_route_presentation.go RawHistoryFolder

1package daemon
2
3// recentRouteKind identifies the origin represented by a presentation value.
4// It is intentionally daemon-local in this layer; ports route kinds are
5// projected into this render-only value at the daemon boundary.
6type recentRouteKind uint8
7
8const (
9	recentRouteLocal recentRouteKind = iota
10	recentRouteRemote
11)
12
13// recentRoutePresentation is the compact immutable value shared by snapshot
14// projection and formatting. It contains only display data; it never carries
15// session ownership, selection identity, transport capabilities, credentials,
16// or attach targets.
17type recentRoutePresentation struct {
18	name      string
19	hostLabel string
20	kind      recentRouteKind
21	ephemeral bool
22	attention bool
23}
24
25// recentRouteDisplay is a formatted, render-ready copy of a presentation. The
26// source value is never mutated while duplicate names are qualified.
27type recentRouteDisplay struct {
28	name      string
29	kind      recentRouteKind
30	ephemeral bool
31	attention bool
32}
33
34// formatRecentRoutePresentations is the single label formatter used by the
35// normal MRU bar and ranked recent-session palette rendering. It returns an
36// owned slice so callers can retain the result without consulting live state.
37func formatRecentRoutePresentations(entries []recentRoutePresentation) []recentRouteDisplay {
38	if entries == nil {
39		return nil
40	}
41	nameCounts := make(map[string]int, len(entries))
42	for _, entry := range entries {
43		nameCounts[entry.name]++
44	}
45
46	out := make([]recentRouteDisplay, len(entries))
47	for i, entry := range entries {
48		out[i] = recentRouteDisplay{
49			name:      formatRecentRouteName(entry, nameCounts[entry.name] > 1),
50			kind:      entry.kind,
51			ephemeral: entry.ephemeral,
52			attention: entry.attention,
53		}
54	}
55	return out
56}
57
58func formatRecentRouteName(entry recentRoutePresentation, ambiguous bool) string {
59	name := entry.name
60	if entry.ephemeral {
61		name += "*"
62	}
63	if entry.kind != recentRouteRemote && !ambiguous {
64		return name
65	}
66
67	host := entry.hostLabel
68	if host == "" {
69		if entry.kind == recentRouteRemote {
70			host = "remote"
71		} else {
72			host = "local"
73		}
74	}
75	return name + "@" + host
76}

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