main 98594d0

fold.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3//go:build ignore
4
5// Command fold reads the "XXXX YYYY" lines printed by `runner.dll --fold`
6// (see gen/runner) on stdin and writes fold_tables.go: the case folding of
7// .NET's StringComparison.OrdinalIgnoreCase, code point by code point.
8package main
9
10import (
11	"bufio"
12	"flag"
13	"fmt"
14	"go/format"
15	"os"
16	"strconv"
17	"strings"
18)
19
20func main() {
21	out := flag.String("o", "", "output file (default stdout)")
22	flag.Parse()
23	var b strings.Builder
24	b.WriteString("// SPDX-License-Identifier: MIT\n\n// Code generated by gen/fold.go from `runner.dll --fold` (gen/runner); DO NOT EDIT.\n\npackage expr\n\n")
25	b.WriteString("// ordinalUpper maps a code point to the one that .NET's OrdinalIgnoreCase comparison treats\n// it as, sorted by the first element. Code points that are not listed stand for themselves.\n")
26	b.WriteString("var ordinalUpper = [...][2]rune{\n")
27	sc := bufio.NewScanner(os.Stdin)
28	n := 0
29	for sc.Scan() {
30		f := strings.Fields(sc.Text())
31		if len(f) != 2 {
32			continue
33		}
34		from, err1 := strconv.ParseInt(f[0], 16, 32)
35		to, err2 := strconv.ParseInt(f[1], 16, 32)
36		if err1 != nil || err2 != nil {
37			fmt.Fprintln(os.Stderr, "bad line:", sc.Text())
38			os.Exit(1)
39		}
40		fmt.Fprintf(&b, "\t{0x%04X, 0x%04X},\n", from, to)
41		n++
42	}
43	b.WriteString("}\n")
44	src, err := format.Source([]byte(b.String()))
45	if err != nil {
46		fmt.Fprintln(os.Stderr, err)
47		os.Exit(1)
48	}
49	if n == 0 {
50		fmt.Fprintln(os.Stderr, "no input")
51		os.Exit(1)
52	}
53	if *out == "" {
54		os.Stdout.Write(src)
55		return
56	}
57	if err := os.WriteFile(*out, src, 0o644); err != nil {
58		fmt.Fprintln(os.Stderr, err)
59		os.Exit(1)
60	}
61}

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 1

Tags 3

↑↓ moveenter openesc close