v0.8.1 1f54f61

session_core.go RawHistoryFolder

1package daemon
2
3import (
4	"sync"
5	"sync/atomic"
6
7	"github.com/bnema/vev/internal/domain"
8)
9
10// sessionCore is the state shared by every attachment-capable session. It is
11// embedded as the first field of session so the existing s.mu selector remains
12// the one lock guarding both attachment membership and local tab state.
13// Geometry claim paths use the partial order mu -> geometry.mu -> sizeMu; no
14// path acquires an architectural lock while holding sizeMu.
15type sessionCore struct {
16	mu sync.Mutex
17
18	id        domain.SessionID
19	name      string
20	ephemeral bool
21	caps      sessionCapabilities
22	// attachments is the session-owned membership registry. Connection
23	// generation and effect state remain attachment-local; admission and view
24	// code use this collection as their membership source.
25	attachments      map[*attachedClient]struct{}
26	attachmentOrder  map[*attachedClient]uint64
27	nextAttachmentID uint64
28	// geometry owns immutable Attachment claims, latest-valid selection, and
29	// accepted shared PTY geometry. Its zero value is ready for Session literals
30	// used by restore and focused tests.
31	geometry    sharedPTYGeometry
32	createdAt   int64
33	incarnation domain.IncarnationID
34	mruAt       atomic.Uint64
35	coordinator atomic.Pointer[renderCoordinator]
36}
37
38func (s *session) core() *sessionCore {
39	if s == nil {
40		return nil
41	}
42	return &s.sessionCore
43}
44
45func (s *session) captureRenderState(ac *attachedClient, req renderCaptureRequest) (*capturedRenderState, bool) {
46	return captureLocalRenderState(s, ac, req)
47}
48
49// validTargetTabLocked validates a target tab index without changing any
50// attachment view. Client-facing navigation updates attachment views through
51// selectAttachmentTab.
52func (s *session) validTargetTabLocked(tabIndex int) bool {
53	if tabIndex < 0 {
54		return true
55	}
56	return tabIndex < len(s.tabs)
57}
58
59func sessionsSnapshot(entries map[domain.SessionID]*session) []*session {
60	sessions := make([]*session, 0, len(entries))
61	for _, sess := range entries {
62		if sess != nil {
63			sessions = append(sessions, sess)
64		}
65	}
66	return sessions
67}

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