v0.6.0 b250c5e

history_codec_payload.go RawHistoryFolder

1package vt
2
3import (
4	"encoding/binary"
5
6	renderer "github.com/bnema/vev-vt/core"
7)
8
9func appendHistoryPayload(dst []byte, value renderer.CellPayload) []byte {
10	dst = binary.BigEndian.AppendUint32(dst, uint32(len(value.Grapheme())))
11	dst = binary.BigEndian.AppendUint32(dst, uint32(len(value.Hyperlink())))
12	dst = append(dst, value.Grapheme()...)
13	return append(dst, value.Hyperlink()...)
14}
15
16func (p *historyParser) payloadDictionary(count uint32, stats *historyDecodeStats) ([]renderer.CellPayload, bool) {
17	if count == 0 {
18		return nil, true
19	}
20	// The record budget bounds the table before allocating any string values.
21	if uint64(count)*renderer.PayloadRecordLogicalBytes > maxHistoryPayloadBytes-stats.payloadBytes {
22		return nil, false
23	}
24	values := make([]renderer.CellPayload, count)
25	seen := make(map[renderer.CellPayload]struct{})
26	for id := range count {
27		grapheme, gok := p.uint32()
28		link, lok := p.uint32()
29		length := uint64(grapheme) + uint64(link)
30		if !gok || !lok || grapheme > renderer.MaxGraphemeBytes || link > renderer.MaxHyperlinkBytes || length == 0 || length > uint64(len(p.data)) {
31			return nil, false
32		}
33		bytes := length + renderer.PayloadRecordLogicalBytes
34		if !addHistoryDecodeBudget(&stats.payloadBytes, bytes, maxHistoryPayloadBytes) || !addHistoryDecodeBudget(&stats.bytes, bytes, maxHistoryDecodedBytes) {
35			return nil, false
36		}
37		value, err := renderer.NewCellPayload(string(p.data[:grapheme]), string(p.data[grapheme:length]))
38		if err != nil {
39			return nil, false
40		}
41		p.data = p.data[length:]
42		if _, duplicate := seen[value]; duplicate {
43			return nil, false
44		}
45		seen[value] = struct{}{}
46		values[id] = value
47	}
48	return values, true
49}

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