v0.1.0 af61ae3

style.go RawHistoryFolder

1package vtcore
2
3type RGB struct {
4	R uint8
5	G uint8
6	B uint8
7}
8
9type StyleAttrs uint16
10
11const (
12	AttrDim StyleAttrs = 1 << iota
13	AttrUnderline
14	AttrBlink
15	AttrStrikethrough
16)
17
18type UnderlineStyle uint8
19
20const (
21	UnderlineNone UnderlineStyle = iota
22	UnderlineSingle
23	UnderlineDouble
24	UnderlineCurly
25	UnderlineDotted
26	UnderlineDashed
27)
28
29type Style struct {
30	Bold       bool
31	Italic     bool
32	Inverse    bool
33	Attrs      StyleAttrs
34	Foreground int // -1 means unset; ignored when HasForegroundRGB is true
35	Background int // -1 means unset; ignored when HasBackgroundRGB is true
36
37	HasForegroundRGB bool
38	ForegroundRGB    RGB
39	HasBackgroundRGB bool
40	BackgroundRGB    RGB
41
42	UnderlineStyle       UnderlineStyle
43	HasUnderlineColor    bool
44	UnderlineColor       int // ignored when HasUnderlineColorRGB is true
45	HasUnderlineColorRGB bool
46	UnderlineColorRGB    RGB
47}
48
49func DefaultStyle() Style { return Style{Foreground: -1, Background: -1} }
50
51func (s Style) Equal(other Style) bool {
52	if s.Bold != other.Bold || s.Italic != other.Italic || s.Inverse != other.Inverse || s.Attrs != other.Attrs || s.UnderlineStyle != other.UnderlineStyle {
53		return false
54	}
55	if s.HasForegroundRGB != other.HasForegroundRGB || s.HasBackgroundRGB != other.HasBackgroundRGB || s.HasUnderlineColorRGB != other.HasUnderlineColorRGB {
56		return false
57	}
58	if s.HasForegroundRGB {
59		if s.ForegroundRGB != other.ForegroundRGB {
60			return false
61		}
62	} else if s.Foreground != other.Foreground {
63		return false
64	}
65	if s.HasBackgroundRGB {
66		if s.BackgroundRGB != other.BackgroundRGB {
67			return false
68		}
69	} else if s.Background != other.Background {
70		return false
71	}
72	if s.HasUnderlineColorRGB {
73		return s.UnderlineColorRGB == other.UnderlineColorRGB
74	}
75	if s.HasUnderlineColor != other.HasUnderlineColor {
76		return false
77	}
78	if s.HasUnderlineColor {
79		return s.UnderlineColor == other.UnderlineColor
80	}
81	return true
82}

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