main f2d166b

position_hint.go RawHistoryFolder

1package vulkan
2
3import (
4	"image"
5
6	"github.com/bnema/neferwl/internal/ports"
7)
8
9func (w *sceneWalk) positionHint() {
10	h := w.s.PositionHint
11	if !h.Shown() {
12		return
13	}
14	b := h.Bounds(w.s.OutputWidth, w.s.OutputHeight)
15	alpha := w.alpha
16	w.alpha = h.Opacity * 0.8
17	w.hintRound(w.physRect(b.X, b.Y, b.W, b.H), w.phys(ports.PositionHintRadius), [3]uint8{30, 30, 38})
18	// The active dot is white, opaque and larger, whatever border.active is:
19	// a grey accent must not blend it into the other dots of its column.
20	for col := range min(int(h.Columns), ports.PositionHintMaxColumns) {
21		for row := range min(int(h.Counts[col]), ports.PositionHintMaxRows) {
22			color, opacity, d := [3]uint8{190, 190, 200}, float32(0.2), ports.PositionHintDiameter
23			if !h.Vertical && col == int(h.ActiveCol) {
24				opacity = 0.45
25			}
26			if col == int(h.ActiveCol) && row == int(h.ActiveRow) {
27				color, opacity, d = [3]uint8{255, 255, 255}, 1, ports.PositionHintActiveDiameter
28			}
29			w.alpha = h.Opacity * opacity
30			// Every dot is centered in its PositionHintDiameter cell.
31			inset := (ports.PositionHintDiameter - d) / 2
32			x := b.X + ports.PositionHintPadding + col*(ports.PositionHintDiameter+ports.PositionHintGap) + inset
33			y := b.Y + ports.PositionHintPadding + row*(ports.PositionHintDiameter+ports.PositionHintGap) + inset
34			w.hintRound(w.physRect(x, y, d, d), w.phys(d)/2, color)
35		}
36	}
37	w.alpha = alpha
38}
39
40// hintRound draws one rounded quad (SDF in the shader), so the pill and each
41// dot cost a single draw whatever the scale. Fills are one translucent draw,
42// so alpha stays exact.
43func (w *sceneWalk) hintRound(r image.Rectangle, radius int, color [3]uint8) {
44	radius = min(radius, r.Dx()/2, r.Dy()/2)
45	w.fillRounded(r, color, float32(radius))
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 26

Tags 10

↑↓ moveenter openesc close