Documentation
¶
Overview ¶
Package sidebar is the right-hand working-context panel shared by tuigoff apps: an ordered list of entity.Ref, rendered by a product-supplied renderer, with a cursor, remove ("x"/Delete), open (Enter) and a resizable split width — generalised from DataTug chat's F6 workspace dock and Ctrl+←/→ split handling (ui.go splitEnabled/ resizeChatPane, workspace_ui.go).
Keybindings: ↑↓/j/k move cursor, x/Delete removes (RemoveMsg), Enter opens (OpenMsg). F6 visibility and Ctrl+←/→ width are concerns of the composing screen (the sidebar only stores/reports width bounds).
Index ¶
- Constants
- type Model
- func (m *Model) Add(ref entity.Ref) bool
- func (m *Model) ChatPercent() int
- func (m *Model) Cursor() int
- func (m *Model) GrowChat(delta int)
- func (m *Model) Refs() []entity.Ref
- func (m *Model) Remove(ref entity.Ref) bool
- func (m *Model) SetVisible(v bool)
- func (m *Model) SetWidth(width int)
- func (m *Model) ShrinkChat(delta int)
- func (m *Model) Title() string
- func (m *Model) Toggle()
- func (m *Model) Update(msg tea.Msg) tea.Cmd
- func (m *Model) View(width int, focused bool) string
- func (m *Model) Visible() bool
- func (m *Model) WithTitle(title string) *Model
- type OpenMsg
- type RemoveMsg
- type Renderer
Constants ¶
const ( MinChatPercent = 40 MaxChatPercent = 75 )
Default split-width bounds, matching DataTug's Ctrl+←/→ chatPanePercent clamp (ui.go: max(40, min(75, ...))). Percent is the CHAT pane's share; the sidebar gets the remainder.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the sidebar panel.
func (*Model) ChatPercent ¶
ChatPercent returns the chat pane's current width share (see MinChatPercent/MaxChatPercent).
func (*Model) GrowChat ¶
GrowChat/ShrinkChat adjust the split by delta percentage points, clamped to [MinChatPercent, MaxChatPercent] (Ctrl+→/Ctrl+← in DataTug).
func (*Model) SetVisible ¶
func (*Model) ShrinkChat ¶
func (*Model) Title ¶
Title returns the sidebar's current header text -- chatshell's own WithSidebarRenderer reads this before replacing m.sidebar wholesale, so a WithSidebarTitle call is never lost regardless of which of the two options a product applies first (see chatshell.WithSidebarRenderer's own doc).
func (*Model) Update ¶
Update handles cursor movement, remove and open key presses. focused gates whether the sidebar consumes the key (callers route key events here only while the focus ring is on the sidebar).
func (*Model) View ¶
View renders the sidebar list using the shared strongo-tui pkg/theme chrome — a header, and per-row selection styling (theme.SelectedRow) matching the same accent every other focused/selected element in an aichat product uses (founder 2026-09-25: side panel styling is centralised, not scattered per package).
func (*Model) WithTitle ¶
WithTitle sets the sidebar's header text (default "Pinned") -- content only, e.g. a product's own name for its working-context list. Chained after New, mirroring chatshell's own With* option shape but scoped to this package's own constructor (sidebar.Model has no other options today).