v0.5.0 31affde

screen_geometry.go RawHistoryFolder

1package vt
2
3// Geometry returns the screen's last frontend-supplied geometry.
4func (s *Screen) Geometry() Geometry {
5	if s == nil {
6		return Geometry{}
7	}
8	return s.geometry
9}
10
11// SetGeometry updates the frontend-supplied cell and optional pixel geometry.
12// Cell changes retain the existing Resize behavior; pixel-only changes do not
13// touch the text frame or damage state.
14func (s *Screen) SetGeometry(geometry Geometry) {
15	if s == nil || !geometry.Valid() {
16		return
17	}
18	cellsChanged := s.geometry.Cols != geometry.Cols || s.geometry.Rows != geometry.Rows
19	geometryChanged := s.geometry != geometry
20	s.geometry = geometry
21	if cellsChanged {
22		s.Resize(geometry.Cols, geometry.Rows)
23	} else if geometryChanged {
24		s.escapeBuf = s.escapeBuf[:0]
25		s.kittyDiscard = false
26		s.kittyDiscardEscaped = false
27		s.abortAllKittyPending()
28	}
29}
30
31// reportWindowSize answers the CSI 14 t and CSI 16 t pixel-geometry queries.
32// Unknown pixel geometry is intentionally not fabricated.
33func (s *Screen) reportWindowSize(parts []int) {
34	if s == nil || len(parts) == 0 || !s.geometry.PixelsKnown() || s.geometry.Rows <= 0 || s.geometry.Cols <= 0 {
35		return
36	}
37	kind := parts[0]
38	var rows, cols int
39	switch kind {
40	case 14:
41		rows, cols = s.geometry.PixelHeight, s.geometry.PixelWidth
42	case 16:
43		rows, cols = s.geometry.PixelHeight/s.geometry.Rows, s.geometry.PixelWidth/s.geometry.Cols
44	default:
45		return
46	}
47	s.respond([]byte("\x1b[" + itoa(kind-10) + ";" + itoa(rows) + ";" + itoa(cols) + "t"))
48}
49
50func itoa(value int) string {
51	if value == 0 {
52		return "0"
53	}
54	var digits [20]byte
55	i := len(digits)
56	for value > 0 {
57		i--
58		digits[i] = byte('0' + value%10)
59		value /= 10
60	}
61	return string(digits[i:])
62}

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 2

Tags 13

↑↓ moveenter openesc close