v0.10.0 d5d679d

hint_labels.go RawHistoryFolder

1package vulkan
2
3import (
4	"image"
5	"math"
6
7	"github.com/bnema/neferwl/internal/adapters/hintlabel"
8)
9
10// hintLabels draws the keyboard hint labels (ports.Scene.HintLabels) over
11// everything, after the capture indicators. Each label is rasterized on the CPU
12// (hintlabel) at the scene's scale and drawn from the SHM copy path: the GPU
13// buffer is cached under a key naming the label, so a label that stays the
14// same uploads once. Captures are rendered from scenes without labels.
15func (w *sceneWalk) hintLabels() {
16	if len(w.s.HintLabels) == 0 {
17		return
18	}
19	r := w.r
20	hs := w.s.HintStyle
21	bg, fg := hintlabel.Colors(w.s.Border.Active, hs.Background, hs.Foreground)
22	style := hintlabel.Style{FontPx: hintlabel.FontPixels(hs.Width, hs.Height, hs.PhysicalW, hs.PhysicalH, w.scale, hs.Size), Background: bg, Foreground: fg}
23	for _, l := range w.s.HintLabels {
24		pix, lw, lh := r.labels.Label(l.Text, l.Typed, w.scale, style)
25		if lw <= 0 || lh <= 0 {
26			continue
27		}
28		// Anchored outside the target's top-left corner, overlapping it by a
29		// quarter of the label height, then kept inside the output.
30		inset := int(math.Round(0.25 * float64(lh)))
31		x := min(max(w.phys(l.Rect.X)-lw+inset, w.bounds.Min.X), max(w.bounds.Max.X-lw, w.bounds.Min.X))
32		y := min(max(w.phys(l.Rect.Y)-lh+inset, w.bounds.Min.Y), max(w.bounds.Max.Y-lh, w.bounds.Min.Y))
33		rect := image.Rect(x, y, x+lw, y+lh)
34		if rect.Intersect(w.bounds).Empty() {
35			continue
36		}
37		key := shmKey{label: l.Text, typed: l.Typed, scale: w.scale, style: style}
38		st := shmState{w: lw, h: lh, seq: 1}
39		c := r.shmCached(key, st)
40		if c == nil {
41			var err error
42			if c, err = r.shmCopyFor(key, st, pix, 0, lw*4, nil); err != nil {
43				continue
44			}
45		}
46		dr := r.contentDraw(rect, rect, lw, lh, [4]float32{}, 0, modeBuffer, true)
47		dr.pc.color[3] = 1
48		dr.shm = c
49		dr.pc.buf = [4]uint32{0, uint32(lw), uint32(lh), 0}
50		w.draws = append(w.draws, dr)
51	}
52}

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 23

Tags 10

↑↓ moveenter openesc close