visual.go RawHistoryFolder

1package term
2
3import "strconv"
4
5const (
6	altScreenEnter        = "\x1b[?1049h"
7	altScreenExit         = "\x1b[?1049l"
8	cursorHide            = "\x1b[?25l"
9	cursorShow            = "\x1b[?25h"
10	cursorStyleDefault    = "\x1b[0 q"
11	mouseEnable           = "\x1b[?1002h\x1b[?1006h"
12	mouseDisable          = "\x1b[?1002l\x1b[?1006l"
13	bracketedPasteEnable  = "\x1b[?2004h"
14	bracketedPasteDisable = "\x1b[?2004l"
15	colorSchemeEnable     = "\x1b[?2031h"
16	colorSchemeDisable    = "\x1b[?2031l"
17	focusReportEnable     = "\x1b[?1004h"
18	focusReportDisable    = "\x1b[?1004l"
19	autowrapDisable       = "\x1b[?7l"
20	autowrapEnable        = "\x1b[?7h"
21	kittyKeyboardPop      = "\x1b[<u"
22)
23
24const visualEnter = altScreenEnter + autowrapDisable + cursorHide + mouseEnable + bracketedPasteEnable + colorSchemeEnable + focusReportEnable
25
26const visualRestore = cursorShow + cursorStyleDefault + mouseDisable +
27	bracketedPasteDisable + colorSchemeDisable + focusReportDisable + autowrapEnable + altScreenExit
28
29// VisualEnterSequence returns a fresh copy of the visual initialization used
30// after acquiring a terminal. It intentionally excludes OS raw-mode setup.
31func VisualEnterSequence() []byte { return []byte(visualEnter) }
32
33// VisualRestoreSequence returns a fresh copy of the idempotent visual cleanup.
34func VisualRestoreSequence() []byte { return []byte(visualRestore) }
35
36// KittyKeyboardPushSequence pushes kitty keyboard protocol flags. Send it
37// after VisualEnterSequence so it lands on the alternate screen's stack.
38func KittyKeyboardPushSequence(flags int) []byte {
39	return []byte("\x1b[>" + strconv.Itoa(flags) + "u")
40}
41
42// VisualRestoreSequenceWithKittyKeyboard pops the kitty keyboard flags pushed
43// on the alternate screen before running the visual cleanup, so the main
44// screen's keyboard mode is left as it was.
45func VisualRestoreSequenceWithKittyKeyboard() []byte {
46	return []byte(kittyKeyboardPop + visualRestore)
47}

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