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 OverlayPopup(above []string, popup []string) []string
- func RegisterHubKeys(km *keys.Map)
- 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 Chip
- type Choice
- 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) BackToDraft()
- func (c *Composer) Bind(sessionID string) tea.Cmd
- func (c *Composer) ClearSelection()
- 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) Holds(x, y int) bool
- func (c *Composer) Insert(text string) tea.Cmd
- func (c *Composer) Kept() []string
- func (c *Composer) Offer(value string, offers []Offer, replace int)
- func (c *Composer) Offset() int
- func (c *Composer) Popup(w int) []string
- func (c *Composer) Press(x, y int)
- func (c *Composer) Rebind()
- func (c *Composer) Recalling() (int, bool)
- func (c *Composer) Release()
- func (c *Composer) Revision() int
- func (c *Composer) SearchKey(id string) (tea.Cmd, bool)
- func (c *Composer) Searching() bool
- func (c *Composer) SelectAll()
- func (c *Composer) Selection() (Selection, bool)
- func (c *Composer) Send() tea.Cmd
- func (c *Composer) SetBusy(on bool)
- func (c *Composer) SetDraftDir(dir string)
- func (c *Composer) SetFocus(on bool) tea.Cmd
- func (c *Composer) SetMinRows(n int)
- 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 Entry
- type Env
- type Field
- type FieldKind
- type Form
- func (f *Form) Commit(id, value string) tea.Cmd
- func (f *Form) Contexts() []string
- func (f *Form) Cursor() *tea.Cursor
- func (f *Form) Hints() []wm.Hint
- func (f *Form) Init() tea.Cmd
- func (f *Form) SetBusy(on bool)
- func (f *Form) SetError(id, text string)
- func (f *Form) SetFields(fields []Field)
- func (f *Form) SetValue(id, value string)
- func (f *Form) Title() string
- func (f *Form) Update(msg tea.Msg) (wm.Card, tea.Cmd)
- func (f *Form) Value(id string) string
- func (f *Form) Values() map[string]string
- func (f *Form) View(w, h int) string
- type FormSpec
- type Helper
- type History
- type Hub
- func (h *Hub) Back() bool
- func (h *Hub) Busy(text string)
- func (h *Hub) Close(c wm.Card) tea.Cmd
- func (h *Hub) Contexts() []string
- func (h *Hub) Cursor() *tea.Cursor
- func (h *Hub) Depth() int
- func (h *Hub) Done(text string) tea.Cmd
- func (h *Hub) Fail(text string) tea.Cmd
- func (h *Hub) Glyph() string
- func (h *Hub) Grabs(x, y int) bool
- func (h *Hub) Hints() []wm.Hint
- func (h *Hub) Holds(c wm.Card) bool
- func (h *Hub) Init() tea.Cmd
- func (h *Hub) Key() string
- func (h *Hub) MinSize() (int, int)
- func (h *Hub) OnClose(fn func() tea.Cmd)
- func (h *Hub) Pop() tea.Cmd
- func (h *Hub) PopTo(c wm.Card) tea.Cmd
- func (h *Hub) Push(c wm.Card) tea.Cmd
- func (h *Hub) Quiet()
- func (h *Hub) Raw() bool
- func (h *Hub) Root() wm.Card
- func (h *Hub) Say(text string, level NoteLevel) tea.Cmd
- func (h *Hub) Selectable() bool
- func (h *Hub) Shown() bool
- func (h *Hub) Status() string
- func (h *Hub) Stick()
- func (h *Hub) Sticky() bool
- func (h *Hub) Swap(c wm.Card) tea.Cmd
- func (h *Hub) Title() string
- func (h *Hub) Top() wm.Card
- func (h *Hub) Update(msg tea.Msg) (wm.Card, tea.Cmd)
- func (h *Hub) View(w, ht int) string
- func (h *Hub) Waiting() bool
- 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) Filter(text string)
- func (l *List) Filtered() bool
- func (l List) Glyph() string
- func (l List) Grabs(x, y int) bool
- func (l *List) HelpLines() []string
- 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) Picks() bool
- 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 NoteLevel
- type Offer
- type Page
- func (p *Page) Contexts() []string
- func (p *Page) End()
- func (p *Page) Hints() []wm.Hint
- func (p *Page) Init() tea.Cmd
- func (p *Page) Key() string
- func (p *Page) Selectable() bool
- func (p *Page) Status() string
- func (p *Page) Title() string
- func (p *Page) Update(msg tea.Msg) (wm.Card, tea.Cmd)
- func (p *Page) View(w, h int) string
- type PageSpec
- 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 Readable
- type Reader
- func (r *Reader) Action(id string) (tea.Cmd, bool)
- func (r *Reader) Active() bool
- func (r *Reader) Contexts() []string
- func (r *Reader) Cursor() int
- func (r *Reader) Hints() []wm.Hint
- func (r *Reader) Line(w int, t theme.Theme) (string, int)
- func (r *Reader) Mark(row int, line string, t theme.Theme) string
- func (r *Reader) MarkBuffer(buf *uv.Buffer, top int, t theme.Theme)
- func (r *Reader) Start(find bool)
- func (r *Reader) Stop()
- func (r *Reader) Take(msg tea.Msg) bool
- func (r *Reader) Typing() bool
- 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) Output() string
- func (t *Terminal) Paint(buf *uv.Buffer)
- func (t *Terminal) Passes(k tea.KeyPressMsg) bool
- func (t *Terminal) Raw() bool
- func (t *Terminal) ReadBlock(row int) (int, int)
- func (t *Terminal) ReadPrompt(from, d int) (int, bool)
- func (t *Terminal) ReadRow(i int) string
- func (t *Terminal) ReadRows() int
- func (t *Terminal) ReadScroll(top int)
- func (t *Terminal) ReadWindow() (int, int)
- 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 TerminalEnd
- type Toolbar
- type UnterminatedQuoteError
Constants ¶
const ( FormContext = "form" FormTextContext = "form.text" FormPickContext = "form.pick" )
Keymap contexts of a form: the keys of every row, of a row typed into and of a row picked from
const DefaultScrollback = 10000
Rows of scrollback a terminal window keeps when no setting names a count
const HubContext = "hub"
Keymap context of the row keys every screen of things to manage answers the same way
const HubViewContext = "hub.view"
Keymap context of the keys a hub answers on every view that takes no typing, help and reading again
Variables ¶
This section is empty.
Functions ¶
func OverlayPopup ¶
Paints the completion popup over the last rows of the lines above the composer, leaving the layout where it was
func RegisterHubKeys ¶
Keys shared by every screen of things to manage, registered with the keymap of the app
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 Chip ¶
type Chip struct {
Kind string `json:"kind"`
Label string `json:"label"`
Text string `json:"text,omitempty"`
Path string `json:"path,omitempty"`
Mime string `json:"mime,omitempty"`
}
Pasted text or an attached file a label in the prompt stands for, kept with the prompt in the history and the drafts
type CommandMsg ¶
Slash command a session composer parsed
type Composer ¶
type Composer struct {
SessionID string
// Store of the prompts the history ring recalls, nil keeping nothing
History History
// Chips the labels of a prompt stand for, kept with it in the history and its draft
Chips func(text string) []Chip
// Called with an entry put into the prompt from the history or a kept draft, so the app takes its chips back
OnRecall func(Entry)
// 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
// 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()
// Stops the running reply, what the send button does while a reply runs and nothing is typed
OnStop func() tea.Cmd
// Whether the session is out of reach, the send button showing it cannot send
Offline bool
// Frame count of the owner's animation clock, the send button pulsing with it while a reply runs
Phase int
// contains filtered or unexported fields
}
Multi line prompt with a history ring over the shared store, the app's completion candidates, attachments and a draft kept per session
func NewComposer ¶
Builds a composer on the keymap keeping the drafts of the sessions it binds under dir, none when empty, completing paths against base
func (*Composer) AtBottom ¶
Reports whether a down key leaves the prompt, it being empty or the cursor on its last screen row with nothing selected
func (*Composer) AtTop ¶
Reports whether an up key leaves the prompt, it being empty or the cursor on its first screen row with nothing selected
func (*Composer) Attachments ¶
Files attached to the next message
func (*Composer) BackToDraft ¶
func (c *Composer) BackToDraft()
Leaves a recalled history entry for the unsent draft, what was typed into the entry kept for when it comes back
func (*Composer) Bind ¶
Binds the prompt to a session: text typed before any session was bound moves to it, a prompt bound to another session keeps its draft there and takes the draft of the new one
func (*Composer) ClearSelection ¶
func (c *Composer) ClearSelection()
Drops the selection, the text left as it is
func (*Composer) Click ¶
Sends when the click lands on the send button, or stops the running reply when nothing is typed, reporting whether it took the click
func (*Composer) Completing ¶
Reports whether the completion popup takes keys for the text typed now, a popup that only informs taking none
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 unless set lower, growing with the wrapped text only. The completion popup floats over the rows above the composer (see Popup) so opening, narrowing or closing it never moves the layout
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) Kept ¶
Texts the prompt keeps out of view while it shows another slot, the draft and the edited history entries, whose chips must stay
func (*Composer) Offer ¶
Shows the candidates the app found for a prompt text, the first one highlighted, none closing the popup. An answer for a text no longer typed is dropped; the list on screen follows the typing on its own until the answer for the current text replaces it
func (*Composer) Popup ¶
Completion rows the owner paints over the rows right above the composer, only those for the text typed now, nil when closed or unfocused
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) 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) Revision ¶
Number that changes whenever the draft is replaced as a whole, by a send, a recall, a search, a session switch or the app setting it, so work started for an older draft can tell it is stale
func (*Composer) SearchKey ¶
Takes an action while a search runs: the search key steps older, the completion key narrows it to the bound session or widens it again, editing keys change the query, escape puts the prompt back, enter and any other key keep the match for editing; reports whether the action was used up and the command it needs
func (*Composer) Send ¶
Sends the prompt as it is typed, whatever the completion popup offers; a line ending in a backslash breaks there instead
func (*Composer) SetDraftDir ¶
Directory the drafts of the bound sessions are kept under, empty keeping them in memory
func (*Composer) SetMinRows ¶
Sets the rows the prompt keeps while it holds less, one on a small terminal where every row counts
func (*Composer) SetTheme ¶
Paints the input with the theme, the prompt mark on the first row only so a long prompt never reads as several
func (*Composer) SetValue ¶
Replaces the text with the cursor at its end, the completion popup closed until the app offers again and a recalled entry left for the draft slot
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 Entry ¶
type Entry struct {
Text string `json:"text"`
Chips []Chip `json:"chips,omitempty"`
Session string `json:"sid,omitempty"`
Cwd string `json:"cwd,omitempty"`
At int64 `json:"ts,omitempty"`
}
Prompt as it was sent or left as a draft, with the chips of its labels, the session it was typed in, the folder and when
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 Field ¶ added in v1.0.11
type Field struct {
ID string
Label string
// One line shown under the field while it has the cursor
Help string
Kind FieldKind
// Text of the field, the value of a choice, true or false for a switch
Value string
Choices []Choice
Required bool
Placeholder string
// Kept behind the more options row until it is opened
More bool
// Says what is wrong with a value, empty when it is fine
Check func(value string) string
}
One field of a form
type FieldKind ¶ added in v1.0.11
type FieldKind int
Kind of value a form field holds
const ( // One line of text FieldText FieldKind = iota // Text shown as dots FieldSecret // Whole or decimal number typed as text FieldNumber // Yes or no FieldBool // One of a set of choices FieldChoice // Line of text that takes no answer FieldNote // Button that runs something of the caller's when pressed FieldButton )
type Form ¶
type Form struct {
// contains filtered or unexported fields
}
Card of fields typed into or picked from, checked and sent with one key
func (*Form) Commit ¶
Sets a field's value and hands it to Changed, as a choice made in a picker of the caller's
func (*Form) SetError ¶
Shows what is wrong with a field under it, such as a refusal of the value, and puts the cursor on it
func (*Form) SetFields ¶
Replaces the fields, such as when an answer shows or hides others, the cursor staying on the field it was on
type FormSpec ¶
type FormSpec struct {
Title string
// Lines above the fields, such as the usage line of a command
Intro []string
Fields []Field
// Word on the button that sends the form
Submit string
// Handed the values by field id once every field checks out
Done func(f *Form, values map[string]string) tea.Cmd
// Runs on the cancel key, nil closing nothing on its own
Cancel func(f *Form) tea.Cmd
// Opens a long list of choices in a picker of the caller's, nil cycling through them in place
Pick func(f *Form, field Field) tea.Cmd
// Runs once a field's answer is given: a switch flipped, a choice made, or text kept as the cursor leaves the field
Changed func(f *Form, field Field) tea.Cmd
// Runs a button field when it is pressed
Press func(f *Form, field Field) tea.Cmd
// Keymap context of the form's own actions and those actions by id
Context string
Actions map[string]func(f *Form) tea.Cmd
// Legend of the form's own actions, ahead of the form keys
Hints []wm.Hint
}
Form a caller describes: its fields, what sending it does and any keys of its own
type Helper ¶
type Helper interface {
HelpLines() []string
}
View of a hub that adds help lines of its own to the help page, such as what the highlighted row does
type History ¶
type History interface {
// Entries oldest first
Entries() []Entry
// Records a sent prompt, an older entry with the same text giving way to it
Add(Entry)
}
Prompts every composer recalls, one store shared by all of them and read at each recall
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Screen of things to manage: views stacked over one root list, the same keys on each, with a note line along the bottom for progress and errors
func (*Hub) Back ¶
Esc on the hub while its view takes typing and has no step back of its own: a stacked view closes, the root lets the hub close
func (*Hub) Contexts ¶
Keymap contexts of the view on top, with help and reading again while it takes no typing
func (*Hub) MinSize ¶
Opens near the whole screen on a small terminal and at a readable width on a large one
func (*Hub) Pop ¶
Closes the view on top and gives the keys back to the one under it, the root staying
func (*Hub) Selectable ¶
func (*Hub) Stick ¶
func (h *Hub) Stick()
Keeps the hub as a question: another overlay holds it beneath instead of dropping it, and only an answer or esc closes it
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
Legend of the table, a pick list naming its filter bar keys for what they do there: enter picks and esc goes back
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
// Columns that give way, first to last, when the width cannot hold every column at a readable width
Yield []int
// Lines the help of a hub shows for row i, the detail of the row when nil
Help func(i int) []string
// A list to pick from: the filter bar takes typing from the start and enter on it runs Primary on the highlighted row
Pick bool
}
Table panel an extension builds, rows and details computed on every view
type Offer ¶
Candidate an app completion source offers, its text put in from the replace offset; one without text only informs
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
Card of text lines scrolled with the list keys, such as help, a sign in in progress or the output of a command
func (*Page) Selectable ¶
type PageSpec ¶
type PageSpec struct {
Title, Key string
// Lines at the width given, styled by the caller
Lines func(w int) []string
// Keymap context of the page's own actions and those actions by id
Context string
Actions map[string]func(p *Page) tea.Cmd
// Legend of the page's own actions, ahead of the scroll keys
Hints func(p *Page) []wm.Hint
// Keeps the last line in view while the page sits at its end, for output that grows
Follow bool
// Runs when the page first shows
Init func(p *Page) tea.Cmd
}
Page a caller describes: lines read on every view, keys of its own and whether it follows its last line
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 Readable ¶
type Readable interface {
// Rows of the text
ReadRows() int
// Plain text of a row
ReadRow(i int) string
// First row in view and how many rows show
ReadWindow() (top, height int)
// Scrolls so that the row is the first in view
ReadScroll(top int)
// Row of the prompt nearest before the row for a negative step or after it for a positive one, false when there is none that way
ReadPrompt(from, d int) (int, bool)
// Rows from and up to of the message or command output that holds the row
ReadBlock(row int) (int, int)
}
Text a reader moves through: its rows as plain text, the window of rows on screen and where its prompts and blocks lie
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reading mode over a text: a cursor row moved with the reading keys, prompts to jump between, a search with its matches, a selection of rows and copying; the same for a transcript, a terminal's scrollback and a long text
func (*Reader) Action ¶
Carries out a reading key, reporting whether the reader took it; the open key is left to the text's owner
func (*Reader) Contexts ¶
Keymap contexts while reading: the search bar and the field keys while a query is typed, else the reading keys
func (*Reader) Line ¶
Line naming the mode with the place of the cursor, the search and the keys that matter, the query with its caret while one is typed
func (*Reader) Mark ¶
One rendered row of the window with the reading marks over it: the cursor and selection in its first cell and the matches lit, its colors kept
func (*Reader) MarkBuffer ¶
Puts the reading marks onto the cells of a painted window whose first row is the text row top: the matches lit and the cursor and selection rows tinted
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 {
// Called once when the program ends, the window closes first or the program fails to start, with what the program left on screen
OnEnd func(TerminalEnd) tea.Cmd
// 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 NewTerminalArgv ¶
Builds terminal number id running a program with its arguments in dir without a shell, the window closing when it ends well and staying open with its output when it fails
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 and the field keys after them 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) Output ¶
Text the program left in the scrollback and on the screen, soft wrapped rows joined and blank rows at the end dropped
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 the window manager have an alt or command key only while a global window key holds it, every other key going to the program, so readline's meta keys reach the shell; nothing passes while the keys are locked
func (*Terminal) Raw ¶ added in v1.0.10
Takes every key as typed while the shell runs and neither the search bar nor reading mode is open
func (*Terminal) ReadBlock ¶
Rows of the command output holding a row, from the prompt at or before it up to the next prompt, the row alone where shells mark no prompts
func (*Terminal) ReadPrompt ¶
Row of the shell prompt before or after a row, for shells that mark their prompts
func (*Terminal) ReadScroll ¶
Scrolls so that the row is the first in view, as far as the scrollback goes
func (*Terminal) ReadWindow ¶
First row in view counted from the oldest one kept, and the rows of the window
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 TerminalEnd ¶
type TerminalEnd struct {
Output string
Exit *term.Exit
// Error that kept the program from starting
Err error
// Whether the window was closed while the program still ran
Closed bool
}
How the program of a window ended, the text it left on screen and in the scrollback and its exit, nil when it never got to exit
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