v0.5.0 c37833b

proto_convert_attachment.go RawHistoryFolder

1package sessionwire
2
3import (
4	"github.com/bnema/vev/internal/protocol"
5	"github.com/bnema/vev/internal/protocol/wire"
6)
7
8func suspendAttachmentToWire(m protocol.SuspendAttachment) (*wire.SuspendAttachment, error) {
9	if err := m.Validate(); err != nil {
10		return nil, err
11	}
12	return &wire.SuspendAttachment{RequestId: m.RequestID}, nil
13}
14func suspendAttachmentFromWire(m *wire.SuspendAttachment) (protocol.SuspendAttachment, error) {
15	out := protocol.SuspendAttachment{RequestID: m.GetRequestId()}
16	return out, out.Validate()
17}
18func attachmentSuspendedToWire(m protocol.AttachmentSuspended) (*wire.AttachmentSuspended, error) {
19	if err := m.Validate(); err != nil {
20		return nil, err
21	}
22	return &wire.AttachmentSuspended{RequestId: m.RequestID, Target: exactTargetToWire(&m.Target)}, nil
23}
24func attachmentSuspendedFromWire(m *wire.AttachmentSuspended) (protocol.AttachmentSuspended, error) {
25	target, err := exactTargetFromWire(m.GetTarget())
26	if err != nil || target == nil {
27		return protocol.AttachmentSuspended{}, protocol.ErrInvalidAttachment
28	}
29	out := protocol.AttachmentSuspended{RequestID: m.GetRequestId(), Target: *target}
30	return out, out.Validate()
31}
32func activateAttachmentToWire(m protocol.ActivateAttachment) (*wire.ActivateAttachment, error) {
33	if err := m.Validate(); err != nil {
34		return nil, err
35	}
36	cols, rows, pw, ph, err := geometryToWire(m.Size, m.PixelWidth, m.PixelHeight)
37	if err != nil {
38		return nil, err
39	}
40	return &wire.ActivateAttachment{RequestId: m.RequestID, Target: exactTargetToWire(&m.Target), Cols: cols, Rows: rows, PixelWidth: pw, PixelHeight: ph}, nil
41}
42func activateAttachmentFromWire(m *wire.ActivateAttachment) (protocol.ActivateAttachment, error) {
43	target, err := exactTargetFromWire(m.GetTarget())
44	if err != nil || target == nil {
45		return protocol.ActivateAttachment{}, protocol.ErrInvalidAttachment
46	}
47	geometry, err := resizeFromWire(&wire.Resize{Cols: m.GetCols(), Rows: m.GetRows(), PixelWidth: m.GetPixelWidth(), PixelHeight: m.GetPixelHeight()})
48	if err != nil {
49		return protocol.ActivateAttachment{}, err
50	}
51	out := protocol.ActivateAttachment{RequestID: m.GetRequestId(), Target: *target, Size: geometry.Size, PixelWidth: geometry.PixelWidth, PixelHeight: geometry.PixelHeight}
52	return out, out.Validate()
53}
54func attachmentActivatedToWire(m protocol.AttachmentActivated) (*wire.AttachmentActivated, error) {
55	if err := m.Validate(); err != nil {
56		return nil, err
57	}
58	identity, err := committedIdentityToWire(m.Identity)
59	if err != nil {
60		return nil, err
61	}
62	return &wire.AttachmentActivated{RequestId: m.RequestID, Identity: identity, Epoch: m.Epoch, State: m.State, ViewPublication: m.ViewPublication}, nil
63}
64func attachmentActivatedFromWire(m *wire.AttachmentActivated) (protocol.AttachmentActivated, error) {
65	identity, err := committedIdentityFromWire(m.GetIdentity())
66	if err != nil {
67		return protocol.AttachmentActivated{}, protocol.ErrInvalidAttachment
68	}
69	out := protocol.AttachmentActivated{RequestID: m.GetRequestId(), Identity: identity, Epoch: m.GetEpoch(), State: m.GetState(), ViewPublication: m.GetViewPublication()}
70	return out, out.Validate()
71}

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 12

Tags 11

↑↓ moveenter openesc close