v0.33.1 9577fee

accent.go RawHistoryFolder

1package entity
2
3import "unicode"
4
5// AccentMap maps base characters to their accented variants.
6// The order determines display order in the accent picker.
7var AccentMap = map[rune][]rune{
8	'a': {'à', 'á', 'â', 'ä', 'ã', 'å', 'æ'},
9	'c': {'ç', 'ć', 'č'},
10	'e': {'è', 'é', 'ê', 'ë', 'ę', 'ė'},
11	'i': {'ì', 'í', 'î', 'ï', 'į'},
12	'n': {'ñ', 'ń'},
13	'o': {'ò', 'ó', 'ô', 'ö', 'õ', 'ø', 'œ'},
14	's': {'ß', 'ś', 'š'},
15	'u': {'ù', 'ú', 'û', 'ü', 'ū'},
16	'y': {'ÿ', 'ý'},
17}
18
19// HasAccents returns true if the given character has accent variants.
20func HasAccents(char rune) bool {
21	lower := unicode.ToLower(char)
22	_, ok := AccentMap[lower]
23	return ok
24}
25
26// GetAccents returns the accent variants for a character.
27// If uppercase is true, returns uppercase variants.
28// Returns nil if the character has no accent variants.
29func GetAccents(char rune, uppercase bool) []rune {
30	lower := unicode.ToLower(char)
31	accents, ok := AccentMap[lower]
32	if !ok {
33		return nil
34	}
35
36	if !uppercase {
37		return accents
38	}
39
40	// Return uppercase versions
41	result := make([]rune, len(accents))
42	for i, a := range accents {
43		result[i] = unicode.ToUpper(a)
44	}
45	return result
46}

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