app_mode_frame.go RawHistoryFolder

1package ui
2
3import (
4	"github.com/bnema/dumber/internal/ui/input"
5	"github.com/bnema/dumber/internal/ui/layout"
6)
7
8func (a *App) modeFrameTarget(bw *browserWindow, mode input.Mode) layout.Widget {
9	wsView := a.activeWorkspaceViewForBrowserWindow(bw)
10	if wsView == nil {
11		return nil
12	}
13	if mode == input.ModeTab || mode == input.ModeSession || mode == input.ModePrefix {
14		return wsView.Widget()
15	}
16	ws := a.activeWorkspaceForBrowserWindow(bw)
17	if ws == nil {
18		return nil
19	}
20	if mode == input.ModePane || mode == input.ModeResize {
21		if stack := wsView.GetStackContainerWidget(ws.ActivePaneID); stack != nil {
22			return stack
23		}
24	}
25	if mode == input.ModeVim || mode == input.ModePane || mode == input.ModeResize {
26		return wsView.GetPaneWidget(ws.ActivePaneID)
27	}
28	return nil
29}
30
31func (a *App) retargetModeFrame(bw *browserWindow, mode input.Mode) {
32	if bw == nil || bw.modeFrame == nil {
33		return
34	}
35	a.setModeFrameTab(bw)
36	newTarget := a.modeFrameTarget(bw, mode)
37	// Rebuilds can temporarily lack a pane widget. Drop the old border while
38	// the next focus/rebuild event retries the target.
39	bw.modeFrame.setTarget(newTarget, modeFrameClass(mode))
40	if bw.modeFrame.visible {
41		bw.modeFrame.refreshGeometry()
42	}
43}
44
45func (a *App) updateModeFrame(bw *browserWindow, mode input.Mode) {
46	if bw == nil || bw.modeFrame == nil {
47		return
48	}
49	a.setModeFrameTab(bw)
50	cfg := a.runtimeConfigSnapshot().UI
51	bw.modeFrame.setMode(mode, a.modeFrameTarget(bw, mode), cfg.Workspace.Styling,
52		cfg.Omnibox.Style, legendActions(mode, cfg.Workspace, cfg.Session))
53}
54
55func (a *App) setModeFrameTab(bw *browserWindow) {
56	tabID := bw.modeFrame.tabID
57	bw.modeFrame.tabID = ""
58	if tab := a.activeTabForBrowserWindow(bw); tab != nil {
59		bw.modeFrame.tabID = tab.ID
60	}
61	if tabID != bw.modeFrame.tabID {
62		bw.modeFrame.dismissLinger()
63	}
64}
65
66func (a *App) modeFrameAction(bw *browserWindow, action input.Action) {
67	if bw != nil && bw.modeFrame != nil {
68		bw.modeFrame.flash(action)
69	}
70}

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