Documentation
¶
Overview ¶
Package panebadge derives a workspace row's compact layout badge from the pane tree that workspace has persisted.
It exists as one helper rather than two because the project workspace sidebar and the global Workspaces browser ("Sessions") are two projections of one model: a workspace showing two panes on one surface is showing two panes on the other, and a badge that disagreed between the lists would be saying the workspace itself was two different things. The rows keep their own two-line design — this only supplies the glyph they put in the metadata they already render.
Index ¶
- Constants
- func ContentLeaves(layout *state.PaneLayoutJSON) int
- func For(wtState state.WorkspaceState, surface string) string
- func Glyph(panes int) string
- func GlyphFor(layout *state.PaneLayoutJSON) string
- func ShellSurface(tmuxName string) string
- func WorktreeSurface(key string) string
- func WorktreeSurfaceFor(path string) string
Constants ¶
const ( // SplitGlyph is a two-pane layout: one workspace, split once. SplitGlyph = "◧◨" // GridPrefix heads a layout with more panes than a single split, followed // by the count, because past two the arrangement stops being something a // glyph can draw at this size and the number is the useful part. GridPrefix = "⊞" )
Variables ¶
This section is empty.
Functions ¶
func ContentLeaves ¶
func ContentLeaves(layout *state.PaneLayoutJSON) int
ContentLeaves counts the content panes a persisted tree restores to. A layout that is stored but hidden restores no panes, so it counts as none: the badge says what is on screen, not what is remembered.
func For ¶
func For(wtState state.WorkspaceState, surface string) string
For is the badge for one surface of one project's saved workspace state. It is the call both sidebars make, so neither can reach a different layout for the same row.
func Glyph ¶
Glyph is GlyphFor's rule stated over a bare pane count, so a caller holding a live tree rather than a persisted one badges it the same way.
func GlyphFor ¶
func GlyphFor(layout *state.PaneLayoutJSON) string
GlyphFor is the badge one persisted tree earns: nothing for the single pane every workspace has, the split pair for two, the grid mark and a count beyond.
func ShellSurface ¶
ShellSurface is the persisted surface identity of one shell's pane tree.
func WorktreeSurface ¶
WorktreeSurface is the persisted surface identity of one worktree's pane tree, given the key the caller already resolved for it.
func WorktreeSurfaceFor ¶
WorktreeSurfaceFor is WorktreeSurface for a worktree named only by its path, which is how the global list holds one. It resolves the same key the project surface persists under, so the two lists reach one saved layout rather than two near-misses.
Types ¶
This section is empty.