workspace.go RawHistoryFolder

1package entity
2
3import "time"
4
5// WorkspaceID uniquely identifies a workspace.
6type WorkspaceID string
7
8// Workspace represents a collection of panes arranged in a tree layout.
9// Each tab contains exactly one workspace.
10type Workspace struct {
11	ID           WorkspaceID
12	Name         string
13	Root         *PaneNode // Root of the pane tree
14	ActivePaneID PaneID    // Currently focused pane
15	CreatedAt    time.Time
16}
17
18// NewWorkspace creates a new workspace with an initial pane.
19func NewWorkspace(id WorkspaceID, initialPane *Pane) *Workspace {
20	root := &PaneNode{
21		ID:   string(initialPane.ID),
22		Pane: initialPane,
23	}
24	return &Workspace{
25		ID:           id,
26		Root:         root,
27		ActivePaneID: initialPane.ID,
28		CreatedAt:    time.Now(),
29	}
30}
31
32// PaneCount returns the number of panes in the workspace.
33func (w *Workspace) PaneCount() int {
34	if w.Root == nil {
35		return 0
36	}
37	return w.Root.LeafCount()
38}
39
40// FindPane searches for a pane by ID in the workspace.
41func (w *Workspace) FindPane(id PaneID) *PaneNode {
42	if w.Root == nil {
43		return nil
44	}
45	return w.Root.FindPane(id)
46}
47
48// ActivePane returns the currently active pane node.
49func (w *Workspace) ActivePane() *PaneNode {
50	return w.FindPane(w.ActivePaneID)
51}
52
53// AllPanes returns all leaf panes in the workspace.
54func (w *Workspace) AllPanes() []*Pane {
55	var panes []*Pane
56	if w.Root == nil {
57		return panes
58	}
59	w.Root.Walk(func(node *PaneNode) bool {
60		if node.Pane != nil {
61			panes = append(panes, node.Pane)
62		}
63		return true
64	})
65	return panes
66}
67
68// VisibleAreaCount returns the number of visible pane areas.
69// Stacked panes count as 1 (only one visible at a time).
70func (w *Workspace) VisibleAreaCount() int {
71	if w.Root == nil {
72		return 0
73	}
74	return w.Root.VisibleAreaCount()
75}

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 8

Tags 42

↑↓ moveenter openesc close