Documentation
¶
Overview ¶
Window manager cards sharing one environment of theme, keys and settings
Index ¶
- Constants
- func DraftPath(dir, sessionID string) string
- func Graphemes(s string) []string
- func ShellWords(line string) ([]string, error)
- func WrapIndent(text string, w, indent int) []string
- func WrapStyled(text string, w int, fg color.Color) []string
- type Attachment
- type Box
- type Button
- type CommandMsg
- type Composer
- func (c *Composer) Action(id string) tea.Cmd
- func (c *Composer) Append(text string) tea.Cmd
- func (c *Composer) AtBottom() bool
- func (c *Composer) AtTop() bool
- func (c *Composer) Attach(path string) tea.Cmd
- func (c *Composer) Attachments() []string
- func (c *Composer) Bind(sessionID string)
- func (c *Composer) Click(x, y int) (tea.Cmd, bool)
- func (c *Composer) Completing() bool
- func (c *Composer) Completions() []string
- func (c *Composer) Cursor() *tea.Cursor
- func (c *Composer) Cut(span Selection) tea.Cmd
- func (c *Composer) Drag(x, y int)
- func (c *Composer) Empty() bool
- func (c *Composer) Fit(w int) int
- func (c *Composer) Height() int
- func (c *Composer) History() []string
- func (c *Composer) Holds(x, y int) bool
- func (c *Composer) Insert(text string) tea.Cmd
- func (c *Composer) Offer(value string, offers []Offer, replace int)
- func (c *Composer) Offset() int
- func (c *Composer) Press(x, y int)
- func (c *Composer) Rebind()
- func (c *Composer) Recalling() (int, bool)
- func (c *Composer) Release()
- func (c *Composer) Remember(text string)
- func (c *Composer) Seed(lines []string)
- func (c *Composer) SelectAll()
- func (c *Composer) Selection() (Selection, bool)
- func (c *Composer) SetBusy(on bool)
- func (c *Composer) SetFocus(on bool) tea.Cmd
- func (c *Composer) SetTheme(t theme.Theme)
- func (c *Composer) SetValue(text string) tea.Cmd
- func (c *Composer) SetValueAt(text string, offset int) tea.Cmd
- func (c *Composer) Status() string
- func (c *Composer) Update(msg tea.Msg) tea.Cmd
- func (c *Composer) Value() string
- func (c *Composer) View(w, h int) string
- type Env
- type List
- func (l *List) Confirm(text string, yes func() tea.Cmd)
- func (l List) Contexts() []string
- func (l List) Cursor() *tea.Cursor
- func (l *List) DetailShown() bool
- func (l *List) EditCell(col int, initial string, done func(l *List, text string) tea.Cmd)
- func (l List) Editing() bool
- func (l List) Glyph() string
- func (l List) Grabs(x, y int) bool
- func (l List) Hints() []wm.Hint
- func (l *List) Index() int
- func (l List) Init() tea.Cmd
- func (l List) Key() string
- func (l *List) Move(d int)
- func (l List) Raw() bool
- func (l *List) Refresh()
- func (l *List) Select(i int) bool
- func (l List) Selectable() bool
- func (l *List) SetTyped(text string)
- func (l List) Status() string
- func (l List) Title() string
- func (l *List) ToggleDetail() tea.Cmd
- func (l *List) Typed() string
- func (l *List) Update(msg tea.Msg) (wm.Card, tea.Cmd)
- func (l List) View(w, h int) string
- type ListInput
- type ListSpec
- type Offer
- type Painter
- func (p *Painter) Cells() *uv.Buffer
- func (p *Painter) Fill(x, y, w, h int, bg color.Color)
- func (p *Painter) Handle(x, y, h int, hot bool)
- func (p *Painter) Label(x, y int, s string, fg, bg color.Color, bold bool) int
- func (p *Painter) Lines(x, y, w, h int, lines []string)
- func (p *Painter) Panel(x, y, w, h int, title string, share float64)
- func (p *Painter) Size() (w, h int)
- func (p *Painter) Styled(x, y, w, h int, s string)
- func (p *Painter) Text(x, y int, s string, fg color.Color, bold bool) int
- func (p *Painter) Theme() theme.Theme
- func (p *Painter) Tint(x, y, w, h int, bg color.Color, share float64)
- func (p *Painter) TintBg(x, y, w, h int, bg color.Color)
- type Row
- type RunMsg
- type Section
- type Sections
- func (d *Sections) At(x, y int) (string, bool)
- func (d *Sections) Follows(id string) bool
- func (d *Sections) IsOpen(id string) bool
- func (d *Sections) Paint(p *Painter, x, y, w, h int, secs []Section, ...)
- func (d *Sections) Rect(id string) (Box, bool)
- func (d *Sections) Scroll(id string, rows int, tail bool)
- func (d *Sections) Show(id string)
- func (d *Sections) Split() int
- func (d *Sections) Toggle(id string)
- func (d *Sections) Top(id string)
- type Selection
- type SettingChangedMsg
- type SubmitMsg
- type Terminal
- func (t *Terminal) Close()
- func (t *Terminal) Contexts() []string
- func (t *Terminal) Cursor() *tea.Cursor
- func (t *Terminal) Cwd() string
- func (t *Terminal) Glyph() string
- func (t *Terminal) Hints() []wm.Hint
- func (t *Terminal) ID() int
- func (t *Terminal) Init() tea.Cmd
- func (t *Terminal) Key() string
- func (t *Terminal) MinSize() (int, int)
- func (t *Terminal) Paint(buf *uv.Buffer)
- func (t *Terminal) Passes(k tea.KeyPressMsg) bool
- func (t *Terminal) Raw() bool
- func (t *Terminal) Run(line string) tea.Cmd
- func (t *Terminal) Selectable() bool
- func (t *Terminal) SetState(raw json.RawMessage) error
- func (t *Terminal) State() any
- func (t *Terminal) Status() string
- func (t *Terminal) Title() string
- func (t *Terminal) Tracks() bool
- func (t *Terminal) Update(msg tea.Msg) (wm.Card, tea.Cmd)
- func (t *Terminal) View(w, h int) string
- type Toolbar
- type UnterminatedQuoteError
Constants ¶
const DefaultScrollback = 10000
Rows of scrollback a terminal window keeps when no setting names a count
Variables ¶
This section is empty.
Functions ¶
func ShellWords ¶
Words of a command line split the way a POSIX shell splits them, honoring quotes and backslashes
func WrapIndent ¶
Lines of styled text wrapped to a width, every line after the first led by an indent of spaces
Types ¶
type Attachment ¶
Image file attached to a message
type Button ¶
type Button struct {
ID string
Label string
On bool
// Buttons of a higher rank leave the bar first when it runs out of room
Rank int
// Gap drawn before the button
Gap bool
}
Button of a toolbar, its action, its words and whether it stands pressed
type CommandMsg ¶
Slash command a session composer parsed
type Composer ¶
type Composer struct {
SessionID string
// Reports whether nothing typed may reach disk, the draft and history kept in memory alone
Volatile func() bool
// Hands every sent line to the app as typed, commands and shell lines included
Literal bool
// Text an empty prompt shows in place of the command and palette legend
Hint string
// Called with each line the history takes, for an app keeping its own history file
OnRemember func(text string)
// Puts the highlighted offer in from its replace offset when the popup is accepted
Apply func(text string, replace int) tea.Cmd
// Called before the prompt is read for sending, for an app that rewrites its draft first
Sending func()
// contains filtered or unexported fields
}
Multi line prompt with history, the app's completion candidates, attachments and a draft kept per session
func NewComposer ¶
Builds a composer on the keymap keeping history and bound drafts under dir, completing paths against base
func (*Composer) AtBottom ¶
Reports whether a down key leaves the prompt, it being empty, a history line being recalled or the cursor on its last line with nothing selected
func (*Composer) AtTop ¶
Reports whether an up key leaves the prompt, it being empty or the cursor on its first line with nothing selected
func (*Composer) Attachments ¶
Files attached to the next message
func (*Composer) Bind ¶
Binds the prompt to a session, text already typed moving to it and otherwise its kept draft coming back
func (*Composer) Completing ¶
Reports whether the completion popup is open for the text typed now
func (*Composer) Completions ¶
Candidates shown in the popup, nil when it is closed
func (*Composer) Cut ¶
Removes the span when it is still the one selected, as a cut does once the clipboard holds its text
func (*Composer) Fit ¶
Fits the input beside the send button at width w, wrapping the text there so the height reads true
func (*Composer) Height ¶
Rows the composer wants, two at least, growing with the wrapped text and the completion popup
func (*Composer) Holds ¶
Reports whether a cell of the composer shows the text of the input, where a press places the cursor and a drag selects
func (*Composer) Offer ¶
Shows the candidates the app found for a prompt text, the first one highlighted, none or a text no longer typed closing the popup
func (*Composer) Press ¶
Starts a selection at a cell of the composer, the cursor going to the grapheme drawn there
func (*Composer) Rebind ¶
func (c *Composer) Rebind()
Rebuilds the editing bindings of the input from the keymap, every other key only typing text
func (*Composer) Recalling ¶
Position in the remembered lines while recalling, false at the unsent draft
func (*Composer) Release ¶
func (c *Composer) Release()
Ends the selection a press started, a press and release on one place leaving the cursor there with nothing selected
func (*Composer) Remember ¶
Adds a draft the person discarded to the history, so recalling brings it back
func (*Composer) Seed ¶
Replaces the remembered lines, oldest first, for an app that keeps the history file itself
func (*Composer) SetValue ¶
Replaces the text with the cursor at its end, the completion popup closed until the app offers again and a recalled history line left behind
func (*Composer) SetValueAt ¶
Replaces the text with the cursor at a rune offset of it, otherwise as SetValue does
func (*Composer) Status ¶
Short trailer naming the attachments with their size and the history position
type Env ¶
type Env struct {
Theme theme.Theme
Keys *keys.Map
// Lifetime of the app
Ctx context.Context
// Setting values as the app holds them keyed by name, empty while unset
Settings func() map[string]string
// Directory the active session works in, Root while unset
WorkDir func() string
// Directory exports and the shell fallback use
ProjectDir string
// Project root the sessions of this instance belong to
Root string
// Version of the program, handed to the shells of terminal windows
Version string
// Terminal graphics as probed, what the terminal draws and how big its cells are
Graphics *gfx.Terminal
// Hands a message to the program from outside its update loop
Send func(tea.Msg)
}
Live state every card may read, nil members standing for parts the app did not build
type List ¶ added in v1.0.11
type List struct {
// contains filtered or unexported fields
}
Table card with a filter bar, detail pane and keymap actions an extension drives through its spec
func NewList ¶ added in v1.0.11
Builds the table from the spec, each action handed the list and the row under the cursor
func (*List) Confirm ¶
Asks a yes or no question along the bottom of the list, yes running the action
func (List) Contexts ¶ added in v1.0.11
func (l List) Contexts() []string
Keymap contexts in force, a capture, a question, an edit or the filter bar ahead of the table
func (List) Cursor ¶ added in v1.0.11
Cursor in the filter bar while it takes typing, else at the end of the cell being typed into, the start of the row input while it is empty
func (*List) DetailShown ¶
Reports whether the detail pane of the selected row is open
func (*List) EditCell ¶
Opens a cell of the selected row for typing from initial, enter handing the trimmed text to done
func (List) Editing ¶ added in v1.0.11
func (l List) Editing() bool
Reports whether a cell is being typed into
func (List) Grabs ¶ added in v1.0.11
Reports whether a press at the cell takes hold of the scrollbar of the detail pane
func (List) Hints ¶ added in v1.0.11
Actions the table answers now, those of its tab first and then the filter and cursor
func (*List) Index ¶ added in v1.0.11
Row under the cursor as an index into the rows, -1 when there is none
func (List) Raw ¶ added in v1.0.11
func (l List) Raw() bool
Takes every key as typed while it waits for a key to bind
func (List) Selectable ¶ added in v1.0.11
func (l List) Selectable() bool
func (List) Status ¶ added in v1.0.11
func (l List) Status() string
Trailer on the frame, what the tab says about its rows and then how many of them a scrolled table hides above and below
func (*List) ToggleDetail ¶ added in v1.0.11
Opens the detail pane of the selected row when closed and closes it when open
type ListInput ¶
type ListInput struct {
// Reports whether row i is the one typed into
Row func(i int) bool
// Column the text shows in
Col int
// Keymap contexts in force on the row ahead of the cell keys, their actions run from the Actions of the spec
Contexts []string
// Handed the trimmed text on the apply key
Done func(l *List, text string) tea.Cmd
// Runs on the cancel key, which clears the text when nil
Cancel func(l *List) tea.Cmd
}
Row of a list that takes typing in place of the table keys while the cursor sits on it
type ListSpec ¶ added in v1.0.11
type ListSpec struct {
Title, Glyph, Key string
// Keymap context of its own actions
Context string
Shared []string
// Action a click on the selected row runs
Primary string
Columns []render.Column
Rows func() [][]string
Detail func(i int) []string
Actions map[string]func(l *List, i int) tea.Cmd
// Actions that apply with no row under the cursor
Free map[string]bool
// Legend of the row under the cursor in place of every action of the context, -1 for none
Hints func(l *List, i int) []wm.Hint
Empty func() string
OnFocus func(l *List) tea.Cmd
// Keeps the cursor on the newest row while it sits there
Follow bool
// Trailer on the frame, ahead of the count of rows a scrolled table hides
Status func() string
// Line above the table while it returns text, such as a part of the rows that failed to load
Banner func() string
// Takes text typed or pasted while the table holds the keys, an unbound printable key or a paste
Typed func(l *List, text string, pasted bool) tea.Cmd
// Runs on a digit picking one of the first ten rows in view, which show their digit
Quick func(l *List, i int) tea.Cmd
// Row typed into in place while the cursor sits on it, nil for a table without one
Input *ListInput
}
Table panel an extension builds, rows and details computed on every view
type Painter ¶
type Painter struct {
// contains filtered or unexported fields
}
Writes text, boxes and panels into the cells of a painted card in the theme
func (*Painter) Handle ¶
Column of grip marks along an edge that drags, lit while the pointer holds it
func (*Painter) Lines ¶
Writes lines down a box, each cut to its width, the rest of the box left as it is
func (*Painter) Panel ¶
Draws a bordered panel with a title over the cells, tinted by a share, its body left for the caller
func (*Painter) Text ¶
Writes plain text at a cell in a color over whatever background is there, cut at the right edge
type RunMsg ¶ added in v1.0.10
Shell line typed with a leading bang, to run in the terminal window beside the session
type Section ¶
type Section struct {
ID string
Title string
// Count shown at the right of the title while nothing is scrolled
Count string
Lines []string
Rows []Row
// Whether the section shares the height left after the fixed ones instead of taking its own
Flex bool
// Whether the section follows its end as lines arrive, until scrolled up
Tail bool
}
Section of a dock, its lines, the clickable rows among them and how it takes height
type Sections ¶
type Sections struct {
// Whether each section is open, every section open until folded
Open map[string]bool
Share float64
// Action under the pointer, its title drawn raised
Hover string
// contains filtered or unexported fields
}
Stack of sections that fold, scroll and share the height of a dock, the flex ones split by a draggable rule
func NewSections ¶
Sections with the first flex one taking the share of the flex height
func (*Sections) Paint ¶
func (d *Sections) Paint(p *Painter, x, y, w, h int, secs []Section, hit func(id string, x, y, w, h int), rowBg func(id string) color.Color)
Draws the sections down a box, each under a title row that folds it, reporting the box of every title and row through the callback and tinting rows by the color the callback gives
func (*Sections) Rect ¶
Box a section took on the last paint, its title row included, false when it was not painted
func (*Sections) Scroll ¶
Scrolls a section by a count of rows, a tailing one leaving its end once scrolled up and following it again once scrolled back down
func (*Sections) Split ¶
Row of the rule between the first two flex sections on the last paint, negative while there is none
type Selection ¶
type Selection struct {
Text string
// contains filtered or unexported fields
}
Span of prompt text a person selected
type SettingChangedMsg ¶ added in v1.0.10
Setting the app applied, sent to every card so those showing it follow
type SubmitMsg ¶
type SubmitMsg struct {
Session string
Text string
Attachments []Attachment
}
Input a session composer sends to its agent
type Terminal ¶ added in v1.0.10
type Terminal struct {
// contains filtered or unexported fields
}
Window running a shell on a pseudo terminal, every key going to it while the window keys still reach the manager
func NewTerminal ¶ added in v1.0.10
Builds terminal number id starting its shell in dir, the agent shell directory when empty
func NewTerminalCommand ¶
Builds terminal number id running one command line through the shell in dir, the window closing when it ends
func (*Terminal) Close ¶ added in v1.0.10
func (t *Terminal) Close()
Ends the shell and waits for it, for a program shutting down
func (*Terminal) Contexts ¶ added in v1.0.10
Keymap contexts, the search bar ahead of the terminal keys while it is open
func (*Terminal) Cursor ¶ added in v1.0.10
Cursor of the shell, or of the search bar while it is open, none while scrolled back or ended
func (*Terminal) Cwd ¶ added in v1.0.10
Working directory of the shell, what it announced, else what the kernel reports, else where it started
func (*Terminal) Paint ¶ added in v1.0.10
Paints the screen with the search, selection, scrollbar and exit banner over it
func (*Terminal) Passes ¶ added in v1.0.10
func (t *Terminal) Passes(k tea.KeyPressMsg) bool
Lets alt, super, hyper, meta and Option typed keys reach the window manager unless the keys are locked
func (*Terminal) Raw ¶ added in v1.0.10
Takes every key as typed while the shell runs and no search bar is open
func (*Terminal) Run ¶ added in v1.0.10
Types a line into the shell, starting it again first when it has ended
func (*Terminal) Selectable ¶ added in v1.0.10
func (*Terminal) SetState ¶ added in v1.0.10
func (t *Terminal) SetState(raw json.RawMessage) error
Starts the next shell in the saved directory when it still exists
type Toolbar ¶
Row of buttons across a painted card, each labeled with its key while they fit, the least needed dropped first
type UnterminatedQuoteError ¶
type UnterminatedQuoteError struct {
Quote rune
}
Error of ShellWords when a quote or a trailing backslash is left open
func (*UnterminatedQuoteError) Error ¶
func (e *UnterminatedQuoteError) Error() string