Documentation
¶
Overview ¶
Package ui implements the Bubbletea terminal application model for toe
Index ¶
- Constants
- Variables
- func AcceptDocumentID(e *view.Editor, id view.DocumentId, action PickerAcceptAction) *view.View
- func AcceptPath(e *view.Editor, path string, action PickerAcceptAction) (*view.View, bool)
- func AlignAcceptedView(e *view.Editor, v *view.View, doc *view.Document)
- func CloseAllTerminalPanes(e *view.Editor)
- func FromTeaKey(k tea.KeyPressMsg) command.KeyEvent
- func NewTokenExpander(e *view.Editor) command.TokenExpander
- func OpenPath(e *view.Editor, path string, action PickerAcceptAction) (*view.View, bool, error)
- func SkipPickerPath(args SkipPickerPathArgs) bool
- func SortPickerItems(items []PickerItem)
- type BinaryPane
- func (p *BinaryPane) Area() geom.Area
- func (p *BinaryPane) Close()
- func (p *BinaryPane) ConsumeDirty() bool
- func (p *BinaryPane) Cursor(*Context) (tea.Cursor, bool)
- func (p *BinaryPane) Discard()
- func (p *BinaryPane) HandleEvent(cx *Context, msg tea.Msg) (EventResult, bool)
- func (p *BinaryPane) ID() view.Id
- func (p *BinaryPane) MarkDirty()
- func (p *BinaryPane) Mode() view.Mode
- func (p *BinaryPane) Path() string
- func (p *BinaryPane) SaveSession(w *view.SessionWriter)
- func (p *BinaryPane) SetArea(a geom.Area)
- func (p *BinaryPane) SetID(id view.Id)
- func (p *BinaryPane) Shutdown()
- func (p *BinaryPane) Split() (view.Pane, error)
- type BufferOverlayComponent
- type BufferRenderer
- type Callback
- type CompletionOptions
- type Component
- type Compositor
- type Context
- type Draggable
- type DynamicPickerSource
- type EditorComponent
- func (e *EditorComponent) Cursor(cx *Context, screen geom.Size) (tea.Cursor, bool)
- func (e *EditorComponent) HandleEvent(cx *Context, msg tea.Msg) (EventResult, tea.Cmd)
- func (e *EditorComponent) MacroRecordAction(ed *view.Editor) command.Continuation
- func (e *EditorComponent) MacroReplayAction(ed *view.Editor) command.Continuation
- func (e *EditorComponent) Render(cx *Context, screen geom.Size) *tui.Buffer
- type EventResult
- type FileBackedPickerSource
- type Image
- type ImagePane
- func (p *ImagePane) Area() geom.Area
- func (p *ImagePane) Close()
- func (p *ImagePane) ConsumeDirty() bool
- func (p *ImagePane) Cursor(*Context) (tea.Cursor, bool)
- func (p *ImagePane) Discard()
- func (p *ImagePane) HandleEvent(cx *Context, msg tea.Msg) (EventResult, bool)
- func (p *ImagePane) ID() view.Id
- func (p *ImagePane) Image() *Image
- func (p *ImagePane) MarkDirty()
- func (p *ImagePane) Mode() view.Mode
- func (p *ImagePane) OnDisplace()
- func (p *ImagePane) OnRevert()
- func (p *ImagePane) Pan() geom.Point
- func (p *ImagePane) PanBy(delta geom.Point)
- func (p *ImagePane) PanDown()
- func (p *ImagePane) PanLeft()
- func (p *ImagePane) PanRight()
- func (p *ImagePane) PanUp()
- func (p *ImagePane) Path() string
- func (p *ImagePane) Reload() error
- func (p *ImagePane) ResetZoom()
- func (p *ImagePane) SaveSession(w *view.SessionWriter)
- func (p *ImagePane) SetArea(a geom.Area)
- func (p *ImagePane) SetID(id view.Id)
- func (p *ImagePane) Shutdown()
- func (p *ImagePane) Split() (view.Pane, error)
- func (p *ImagePane) Zoom() int
- func (p *ImagePane) ZoomIn()
- func (p *ImagePane) ZoomOut()
- type MatchResult
- type Model
- func (m Model) Animation() bool
- func (m Model) AutoSize() bool
- func (m Model) AutoSizeVerticalPercent() int
- func (m Model) Close()
- func (m Model) CmdModeAction(_ *view.Editor)
- func (m Model) CodeActionPickerAction(e *view.Editor)
- func (m Model) CommandPaletteAction(e *view.Editor)
- func (m Model) CompletionAction(e *view.Editor)
- func (m Model) CompletionOptions() CompletionOptions
- func (m Model) ExecTypable(input string) Model
- func (m Model) GotoDeclarationAction(e *view.Editor)
- func (m Model) GotoDefinitionAction(e *view.Editor)
- func (m Model) GotoImplementationAction(e *view.Editor)
- func (m Model) GotoReferenceAction(e *view.Editor)
- func (m Model) GotoTypeDefinitionAction(e *view.Editor)
- func (m Model) HoverAction(e *view.Editor)
- func (m Model) Init() tea.Cmd
- func (m Model) LastPickerAction(e *view.Editor)
- func (m Model) MacroRecordAction(e *view.Editor) command.Continuation
- func (m Model) MacroReplayAction(e *view.Editor) command.Continuation
- func (m Model) PickerAction(fn PickerFunc) command.Action
- func (m Model) PickerLayoutOptions() PickerLayoutOptions
- func (m Model) RegexAction(prompt string, fn promptHandler) command.Action
- func (m Model) RenameSymbolAction(e *view.Editor)
- func (m Model) ResizeViewAction(e *view.Editor) command.Continuation
- func (m Model) SearchAction(forward bool) command.Action
- func (m Model) SelectReferencesAction(e *view.Editor)
- func (m Model) SetAnimation(enabled bool)
- func (m Model) SetAutoSize(enabled bool)
- func (m Model) SetAutoSizeVerticalPercent(percent int)
- func (m Model) SetCompletionOptions(opts CompletionOptions)
- func (m Model) SetPickerLayoutOptions(opts PickerLayoutOptions)
- func (m Model) ShellAction(prompt string, fn promptHandler) command.Action
- func (m Model) SignatureHelpAction(e *view.Editor)
- func (m Model) SymbolPickerAction(e *view.Editor)
- func (m Model) TerminalAction(e *view.Editor)
- func (m Model) TerminalSearchAction(e *view.Editor)
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() tea.View
- func (m Model) WithInitialPicker(fn PickerFunc) Model
- func (m Model) WithStartupCmd(cmd tea.Cmd) Model
- func (m Model) WithStartupMessage(msg string) Model
- func (m Model) WorkspaceSymbolPickerAction(e *view.Editor)
- type NavigablePickerSource
- type PaneCursor
- type PaneInput
- type Pasteable
- type Picker
- type PickerAcceptAction
- type PickerBase
- type PickerComponent
- func (p *PickerComponent) Cursor(*Context, geom.Size) (cur tea.Cursor, ok bool)
- func (p *PickerComponent) HandleEvent(cx *Context, msg tea.Msg) (EventResult, tea.Cmd)
- func (p *PickerComponent) Layout(_ *Context, screen geom.Size) (geom.Area, bool)
- func (p *PickerComponent) PaintBuffer(cx *Context, pl geom.Area) *tui.Buffer
- type PickerFunc
- type PickerIgnore
- type PickerIgnoreOptions
- type PickerItem
- type PickerLayoutOptions
- type PickerLineRange
- type PickerLocation
- type PickerMatcher
- type PickerPreviewSkipper
- type PickerSource
- type PickerTarget
- type PreviewRenderer
- type PromptComponent
- func (p *PromptComponent) Cursor(cx *Context, _ geom.Size) (cur tea.Cursor, ok bool)
- func (p *PromptComponent) HandleEvent(cx *Context, msg tea.Msg) (EventResult, tea.Cmd)
- func (p *PromptComponent) Layout(cx *Context, screen geom.Size) (geom.Area, bool)
- func (p *PromptComponent) PaintBuffer(cx *Context, pl geom.Area) *tui.Buffer
- type SkipPickerPathArgs
- type StaticPickerSource
- type StopFunc
- type TerminalPane
- func (t *TerminalPane) Area() geom.Area
- func (t *TerminalPane) BeginDrag(cx *Context, at geom.Point, mod tea.KeyMod) bool
- func (t *TerminalPane) CancelDrag()
- func (t *TerminalPane) Close()
- func (t *TerminalPane) Closed() <-chan struct{}
- func (t *TerminalPane) ConsumeBell(focused bool) bool
- func (t *TerminalPane) ConsumeDirty() bool
- func (t *TerminalPane) ContinueDrag(cx *Context, at geom.Point) tea.Cmd
- func (t *TerminalPane) Cursor(cx *Context) (tea.Cursor, bool)
- func (t *TerminalPane) Discard()
- func (t *TerminalPane) DragTick(_ *Context, gen int, toTop bool) tea.Cmd
- func (t *TerminalPane) Emulator() *vt.SafeEmulator
- func (t *TerminalPane) EndDrag(cx *Context, at geom.Point) tea.Cmd
- func (t *TerminalPane) HandleEvent(cx *Context, msg tea.Msg) (EventResult, bool)
- func (t *TerminalPane) ID() view.Id
- func (t *TerminalPane) IngestOutput(data []byte)
- func (t *TerminalPane) MarkDirty()
- func (t *TerminalPane) Mode() view.Mode
- func (t *TerminalPane) MouseEnabled() bool
- func (t *TerminalPane) Paste(text string)
- func (t *TerminalPane) Path() string
- func (t *TerminalPane) SaveSession(w *view.SessionWriter)
- func (t *TerminalPane) ScrollLines(n int)
- func (t *TerminalPane) ScrollOffset() int
- func (t *TerminalPane) ScrollToBottom()
- func (t *TerminalPane) SearchScrollback(pattern string) bool
- func (t *TerminalPane) SendKey(k uv.KeyEvent)
- func (t *TerminalPane) SendMouse(m uv.MouseEvent)
- func (t *TerminalPane) SetArea(a geom.Area)
- func (t *TerminalPane) SetID(id view.Id)
- func (t *TerminalPane) SetRedraw(fn func())
- func (t *TerminalPane) Shutdown()
- func (t *TerminalPane) Split() (view.Pane, error)
- func (t *TerminalPane) Stop() error
- func (t *TerminalPane) Title() string
Constants ¶
const ( // CompletionAcceptAction accepts the selected completion item CompletionAcceptAction = "completion_accept" // CompletionCancelAction dismisses the completion popup CompletionCancelAction = "completion_cancel" // CompletionPreviousAction selects the previous completion item CompletionPreviousAction = "completion_previous" // CompletionNextAction selects the next completion item CompletionNextAction = "completion_next" // CompletionPageUpAction moves selection up by one completion page CompletionPageUpAction = "completion_page_up" // CompletionPageDownAction moves selection down by one completion page CompletionPageDownAction = "completion_page_down" // CompletionFirstAction selects the first completion item CompletionFirstAction = "completion_first" // CompletionLastAction selects the last completion item CompletionLastAction = "completion_last" )
const ( // DefaultCompletionDelay is the idle time before an automatic request, // long enough that a fast typist does not queue one per keystroke DefaultCompletionDelay = 250 DefaultCompletionTriggerLen = 2 )
const ( DefaultPickerSplitRatio = 0.5 MinPickerSplitRatio = 0.2 MaxPickerSplitRatio = 0.8 )
const DefaultAutoSizeVerticalPct = 67
DefaultAutoSizeVerticalPct is the percent of the parent split a pane grows to vertically when no percent is configured
const PickerMaxPreview = 10 * 1024 * 1024
PickerMaxPreview is the largest file size a picker will preview inline
Variables ¶
var ( ErrNoFocusedDocument = errors.New("no focused document") ErrNoFocusedView = errors.New("no focused view") ErrUnknownVariable = errors.New("unknown variable") ErrInvalidUnicode = errors.New("invalid Unicode codepoint") ErrShellExpansion = errors.New("shell expansion failed") ErrInvalidRegister = errors.New("invalid register") )
var ErrInvalidImage = errors.New("invalid image")
ErrInvalidImage reports a file that cannot be decoded as an image
var ErrScrollbackNoMatch = errors.New("pattern not found in scrollback")
Functions ¶
func AcceptDocumentID ¶
func AcceptDocumentID( e *view.Editor, id view.DocumentId, action PickerAcceptAction, ) *view.View
AcceptDocumentID opens the document by id, splitting per action, and returns the view now showing it
func AcceptPath ¶
AcceptPath opens the file at path (switching to it if already open), splitting per action, and returns the view now showing it
func AlignAcceptedView ¶
AlignAcceptedView scrolls the view so the accepted document's cursor is visible after a picker jump
func CloseAllTerminalPanes ¶
CloseAllTerminalPanes kills every open terminal's shell so the process does not orphan them on exit
func FromTeaKey ¶
func FromTeaKey(k tea.KeyPressMsg) command.KeyEvent
FromTeaKey converts a Bubbletea v2 KeyPressMsg to a KeyEvent
func NewTokenExpander ¶
func NewTokenExpander(e *view.Editor) command.TokenExpander
NewTokenExpander returns a TokenExpander that resolves percent-expansions using the current editor state (selections, registers, variables, shell)
func SkipPickerPath ¶
func SkipPickerPath(args SkipPickerPathArgs) bool
SkipPickerPath reports whether a walked entry should be excluded from a picker's file listing under the given ignore rules
func SortPickerItems ¶
func SortPickerItems(items []PickerItem)
SortPickerItems sorts items by display text, the default ordering for static picker sources
Types ¶
type BinaryPane ¶ added in v0.1.21
type BinaryPane struct {
// contains filtered or unexported fields
}
BinaryPane displays a read-only, responsive hexadecimal dump
func NewBinaryPane ¶ added in v0.1.21
func NewBinaryPane(e *view.Editor, path string) (*BinaryPane, error)
NewBinaryPane opens path as a read-only binary dump
func (*BinaryPane) Area ¶ added in v0.1.21
func (p *BinaryPane) Area() geom.Area
Area returns the screen rectangle assigned by the layout tree
func (*BinaryPane) Close ¶ added in v0.1.21
func (p *BinaryPane) Close()
Close closes this binary pane
func (*BinaryPane) ConsumeDirty ¶ added in v0.1.21
func (p *BinaryPane) ConsumeDirty() bool
ConsumeDirty reports and clears whether the pane changed
func (*BinaryPane) Cursor ¶ added in v0.1.21
func (p *BinaryPane) Cursor(*Context) (tea.Cursor, bool)
Cursor reports that a binary pane has no text cursor
func (*BinaryPane) Discard ¶ added in v0.1.21
func (p *BinaryPane) Discard()
Discard releases this displaced binary pane
func (*BinaryPane) HandleEvent ¶ added in v0.1.21
func (p *BinaryPane) HandleEvent( cx *Context, msg tea.Msg, ) (EventResult, bool)
HandleEvent scrolls the binary dump
func (*BinaryPane) ID ¶ added in v0.1.21
func (p *BinaryPane) ID() view.Id
ID returns the pane identifier
func (*BinaryPane) MarkDirty ¶ added in v0.1.21
func (p *BinaryPane) MarkDirty()
MarkDirty flags the pane as needing a repaint
func (*BinaryPane) Mode ¶ added in v0.1.21
func (p *BinaryPane) Mode() view.Mode
Mode reports binary dump mode
func (*BinaryPane) Path ¶ added in v0.1.21
func (p *BinaryPane) Path() string
Path returns the binary file path
func (*BinaryPane) SaveSession ¶ added in v0.1.21
func (p *BinaryPane) SaveSession(w *view.SessionWriter)
SaveSession stores the binary path and viewport offset
func (*BinaryPane) SetArea ¶ added in v0.1.21
func (p *BinaryPane) SetArea(a geom.Area)
SetArea sets the screen rectangle assigned by the layout tree
func (*BinaryPane) SetID ¶ added in v0.1.21
func (p *BinaryPane) SetID(id view.Id)
SetID sets the pane identifier
func (*BinaryPane) Shutdown ¶ added in v0.1.21
func (p *BinaryPane) Shutdown()
Shutdown releases external resources owned by this pane
type BufferOverlayComponent ¶
type BufferOverlayComponent interface {
Component
Layout(*Context, geom.Size) (geom.Area, bool)
PaintBuffer(*Context, geom.Area) *tui.Buffer
}
BufferOverlayComponent extends Component for overlay layers that own their own cell buffer instead of drawing into the shared one
type BufferRenderer ¶
BufferRenderer exposes the raw cell buffer a base component rendered into, so overlay layers can draw directly onto it
type Callback ¶
type Callback func(*Context, *Compositor) tea.Cmd
Callback lets a component push, pop, or mutate compositor layers without direct coupling — the compositor executes it after event propagation completes
type CompletionOptions ¶ added in v0.1.13
type CompletionOptions struct {
Auto bool `toml:"auto"`
Delay int `toml:"delay"`
TriggerLen int `toml:"trigger-len"`
}
CompletionOptions controls the completion popup that appears while typing, without an explicit completion keypress
func DefaultCompletionOptions ¶ added in v0.1.13
func DefaultCompletionOptions() CompletionOptions
DefaultCompletionOptions returns the automatic completion defaults
type Component ¶
type Component interface {
HandleEvent(*Context, tea.Msg) (EventResult, tea.Cmd)
Cursor(*Context, geom.Size) (tea.Cursor, bool)
}
Component is the interface every compositor layer must implement
type Compositor ¶
type Compositor struct {
// contains filtered or unexported fields
}
func (*Compositor) HandleEvent ¶
func (*Compositor) Pop ¶
func (c *Compositor) Pop()
func (*Compositor) Push ¶
func (c *Compositor) Push(layer Component)
func (*Compositor) Render ¶
func (c *Compositor) Render(cx *Context) string
type Context ¶
type Context struct {
Editor *view.Editor
Keymaps *command.Keymaps
Syntax *syntax.Cache
// contains filtered or unexported fields
}
Context holds shared mutable state accessible to all compositor layers
func (*Context) StyleGen ¶
StyleGen returns a counter that increments whenever the active theme changes, letting cached overlay buffers know they must repaint even without their own content changing
type Draggable ¶
type Draggable interface {
BeginDrag(*Context, geom.Point, tea.KeyMod) bool
ContinueDrag(*Context, geom.Point) tea.Cmd
EndDrag(*Context, geom.Point) tea.Cmd
CancelDrag()
DragTick(cx *Context, gen int, toTop bool) tea.Cmd
}
Draggable is a pane that handles mouse drags itself. Drags span several events with cross-event state, so they stay separate from PaneInput
type DynamicPickerSource ¶
type DynamicPickerSource interface {
PickerSource
Search(query string)
}
DynamicPickerSource extends PickerSource with query-driven search
type EditorComponent ¶
type EditorComponent struct {
// contains filtered or unexported fields
}
func (*EditorComponent) HandleEvent ¶
func (e *EditorComponent) HandleEvent( cx *Context, msg tea.Msg, ) (EventResult, tea.Cmd)
func (*EditorComponent) MacroRecordAction ¶
func (e *EditorComponent) MacroRecordAction( ed *view.Editor, ) command.Continuation
MacroRecordAction starts or stops macro recording. When not recording, prompts for a register key and begins recording. When already recording, stops and saves the macro to the chosen register
func (*EditorComponent) MacroReplayAction ¶
func (e *EditorComponent) MacroReplayAction( ed *view.Editor, ) command.Continuation
MacroReplayAction prompts for a register key and replays the macro stored there count times
type EventResult ¶
EventResult is returned by every Component.HandleEvent call
type FileBackedPickerSource ¶ added in v0.1.27
type FileBackedPickerSource interface {
PickerSource
// ItemForPath returns the current row for path and whether the source
// contains it
ItemForPath(e *view.Editor, path string) (PickerItem, bool)
}
FileBackedPickerSource is a picker whose rows are workspace files, each reconciled one changed path at a time
type Image ¶
Image holds decoded image data, its content identifier, and the decoded source format (e.g. "png") for transmission fast paths
type ImagePane ¶
type ImagePane struct {
// contains filtered or unexported fields
}
ImagePane displays an image in the editor's pane tree, zooming and panning it in response to keys and mouse, and shows no text cursor
func NewImagePane ¶
NewImagePane loads path into an image pane
func (*ImagePane) ConsumeDirty ¶
ConsumeDirty reports and clears whether the pane changed
func (*ImagePane) Discard ¶
func (p *ImagePane) Discard()
Discard releases this displaced image pane
func (*ImagePane) HandleEvent ¶
HandleEvent handles image mouse input: a left click zooms in, a right or modified left click zooms out, a bare wheel pans, and a modified wheel zooms. Everything else falls through to the editor
func (*ImagePane) MarkDirty ¶
func (p *ImagePane) MarkDirty()
MarkDirty flags the pane as needing a repaint
func (*ImagePane) OnDisplace ¶ added in v0.1.16
func (p *ImagePane) OnDisplace()
OnDisplace drops the decoded bitmap while the pane is stashed behind another pane, freeing its memory
func (*ImagePane) OnRevert ¶ added in v0.1.16
func (p *ImagePane) OnRevert()
OnRevert re-decodes the backing file when the pane returns to view
func (*ImagePane) Reload ¶
Reload re-decodes the backing file after an external change; the new bytes yield a new ContentID, so the display path retransmits automatically
func (*ImagePane) ResetZoom ¶
func (p *ImagePane) ResetZoom()
ResetZoom restores the fitted image scale and recenters the view
func (*ImagePane) SaveSession ¶
func (p *ImagePane) SaveSession(w *view.SessionWriter)
SaveSession stores the image path so the pane can be reopened
func (*ImagePane) Shutdown ¶
func (p *ImagePane) Shutdown()
Shutdown releases external resources owned by this pane
type MatchResult ¶ added in v0.1.19
MatchResult is a source's verdict on one item: its rank against the query, and the rune offsets to highlight in the matched column
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubbletea model — a thin wrapper around Compositor
func (Model) Animation ¶ added in v0.1.32
Animation reports whether UI animations (such as auto-size growth) play
func (Model) AutoSize ¶ added in v0.1.28
AutoSize reports whether focused editor panes grow to show the leftmost ruler
func (Model) AutoSizeVerticalPercent ¶ added in v0.1.32
AutoSizeVerticalPercent reports the percent of its parent split a focused pane grows to vertically, or 0 when vertical auto-sizing is off
func (Model) Close ¶ added in v0.1.27
func (m Model) Close()
Close releases the model's long-lived resources, such as file watches
func (Model) CmdModeAction ¶
func (Model) CodeActionPickerAction ¶
func (Model) CommandPaletteAction ¶
func (Model) CompletionAction ¶
func (Model) CompletionOptions ¶ added in v0.1.13
func (m Model) CompletionOptions() CompletionOptions
CompletionOptions returns the UI-owned automatic completion settings
func (Model) ExecTypable ¶
func (Model) GotoDeclarationAction ¶
func (Model) GotoDefinitionAction ¶
func (Model) GotoImplementationAction ¶
func (Model) GotoReferenceAction ¶
func (Model) GotoTypeDefinitionAction ¶
func (Model) HoverAction ¶
func (Model) LastPickerAction ¶
func (Model) MacroRecordAction ¶
func (m Model) MacroRecordAction(e *view.Editor) command.Continuation
func (Model) MacroReplayAction ¶
func (m Model) MacroReplayAction(e *view.Editor) command.Continuation
func (Model) PickerAction ¶
func (m Model) PickerAction(fn PickerFunc) command.Action
func (Model) PickerLayoutOptions ¶
func (m Model) PickerLayoutOptions() PickerLayoutOptions
PickerLayoutOptions returns the UI-owned picker layout settings
func (Model) RegexAction ¶
func (Model) RenameSymbolAction ¶
func (Model) ResizeViewAction ¶
func (m Model) ResizeViewAction(e *view.Editor) command.Continuation
ResizeViewAction enters an interactive resize mode: h/l (or left/right) and j/k (or up/down) push the focused split's border in that literal screen direction, one cell per keypress, until Escape or Enter exits
func (Model) SelectReferencesAction ¶
func (Model) SetAnimation ¶ added in v0.1.32
SetAnimation controls whether UI animations play; when off they snap to their final state
func (Model) SetAutoSize ¶ added in v0.1.28
SetAutoSize controls whether focused editor panes grow to show their leftmost ruler
func (Model) SetAutoSizeVerticalPercent ¶ added in v0.1.32
SetAutoSizeVerticalPercent sets the vertical growth percent, clamped to [0, 100]; 0 disables vertical auto-sizing
func (Model) SetCompletionOptions ¶ added in v0.1.13
func (m Model) SetCompletionOptions(opts CompletionOptions)
SetCompletionOptions applies UI-owned automatic completion settings
func (Model) SetPickerLayoutOptions ¶
func (m Model) SetPickerLayoutOptions(opts PickerLayoutOptions)
SetPickerLayoutOptions applies UI-owned picker layout settings
func (Model) ShellAction ¶
func (Model) SignatureHelpAction ¶
func (Model) SymbolPickerAction ¶
func (Model) TerminalAction ¶
TerminalAction opens the user's shell in the focused pane
func (Model) TerminalSearchAction ¶
TerminalSearchAction opens a prompt that jumps the focused terminal's scrollback to the nearest match above the current view
func (Model) WithInitialPicker ¶
func (m Model) WithInitialPicker(fn PickerFunc) Model
func (Model) WithStartupMessage ¶
WithStartupMessage sets a status bar message for the first frame
func (Model) WorkspaceSymbolPickerAction ¶
type NavigablePickerSource ¶
type NavigablePickerSource interface {
PickerSource
}
NavigablePickerSource extends PickerSource for pickers that can drill into sub-pickers. Navigate returns a PickerFunc to replace the current picker, or nil to fall through to Accept
type PaneCursor ¶
PaneCursor is a pane that positions its own cursor
type PaneInput ¶
type PaneInput interface {
HandleEvent(*Context, tea.Msg) (EventResult, bool)
}
PaneInput is a pane that handles bubbletea key and mouse events itself. It receives the event first; an unconsumed event (handled=false) falls through to the editor's default keymap/document handling
type Pasteable ¶
type Pasteable interface {
Paste(text string)
}
Pasteable is a pane that consumes a paste itself instead of the document/selection paste
type Picker ¶
type Picker struct {
// contains filtered or unexported fields
}
Picker holds the runtime state for an open picker overlay
func CommandPalettePicker ¶
CommandPalettePicker opens a picker listing all registered commands
func LSPWorkspaceCommandPicker ¶
LSPWorkspaceCommandPicker opens commands exposed by language servers
func NewChangedFilePicker ¶
NewChangedFilePicker lists workspace files the version-control system reports as changed
func NewPicker ¶
func NewPicker(e *view.Editor, source PickerSource) *Picker
NewPicker constructs a Picker for the given source, triggering Load immediately. The returned feedCmd (if any) must be dispatched by the caller after mounting the component
func (*Picker) MatchCount ¶
MatchCount reports how many items currently match the query
func (*Picker) SelectIndex ¶
SelectIndex moves the cursor to i when it is a valid match index
type PickerAcceptAction ¶
type PickerAcceptAction int
const ( PickerAcceptReplace PickerAcceptAction = iota PickerAcceptHorizontalSplit PickerAcceptVerticalSplit )
type PickerBase ¶
type PickerBase struct {
// contains filtered or unexported fields
}
PickerBase is an optional starting point a source can embed for default id, column, and fuzzy-match behavior; a source is free to implement those methods itself instead
func NewPickerBase ¶
func NewPickerBase( id string, columns []string, matchColumn int, proportions []int, ) PickerBase
NewPickerBase builds the fixed metadata a source embeds: kebab-case id, column headers, the column matched against, and each column's flex weight
func (PickerBase) ColumnProportions ¶
func (p PickerBase) ColumnProportions() []int
func (PickerBase) Columns ¶
func (p PickerBase) Columns() []string
func (PickerBase) ID ¶
func (p PickerBase) ID() string
func (PickerBase) MatchColumn ¶
func (p PickerBase) MatchColumn() int
func (PickerBase) PrepareMatcher ¶ added in v0.1.19
func (p PickerBase) PrepareMatcher(query string) PickerMatcher
PrepareMatcher prepares a query for matching multiple items
type PickerComponent ¶
type PickerComponent struct {
// contains filtered or unexported fields
}
func (*PickerComponent) HandleEvent ¶
func (p *PickerComponent) HandleEvent( cx *Context, msg tea.Msg, ) (EventResult, tea.Cmd)
func (*PickerComponent) PaintBuffer ¶
type PickerFunc ¶
PickerFunc constructs a Picker from the editor
type PickerIgnore ¶
type PickerIgnore struct {
// contains filtered or unexported fields
}
func LoadIgnoreFiles ¶
func LoadIgnoreFiles( root, path string, opts PickerIgnoreOptions, ) []PickerIgnore
type PickerIgnoreOptions ¶
func DefaultPickerIgnoreOptions ¶
func DefaultPickerIgnoreOptions() PickerIgnoreOptions
DefaultPickerIgnoreOptions is the ignore behavior file-walking pickers use when a caller does not need to customize it
type PickerItem ¶
type PickerItem struct {
Display string
Columns []string
StyleScopes []string
SortKey string
Preview PreviewRenderer
Location PickerLocation
Payload any
DiffHunks []view.DiffHunk
DiffPreview bool
DiffKind view.FileChangeKind
BasePath string
}
PickerItem is a single row shown in the picker list
type PickerLayoutOptions ¶
func (PickerLayoutOptions) SplitRatioFor ¶
func (o PickerLayoutOptions) SplitRatioFor(key string) float64
SplitRatioFor returns the saved split ratio for a picker key
type PickerLineRange ¶
type PickerLocation ¶
type PickerLocation struct {
Target PickerTarget
Lines *PickerLineRange
}
PickerLocation holds a target and an optional line range
type PickerMatcher ¶ added in v0.1.19
type PickerMatcher func(*PickerItem) (MatchResult, bool)
PickerMatcher matches picker items against a prepared query
type PickerPreviewSkipper ¶
type PickerPreviewSkipper interface {
SkipPreview()
}
PickerPreviewSkipper marks picker sources that never render previews
type PickerSource ¶
type PickerSource interface {
ID() string
Columns() []string
MatchColumn() int
ColumnProportions() []int
Load(*view.Editor) ([]PickerItem, <-chan PickerItem, StopFunc)
Accept(*view.Editor, *PickerItem, PickerAcceptAction)
}
PickerSource is implemented by every picker data source
type PickerTarget ¶
type PickerTarget struct {
Path string
ID view.DocumentId
}
PickerTarget identifies a document by path or in-memory ID
func (PickerTarget) Valid ¶
func (p PickerTarget) Valid() bool
Valid reports whether the target refers to a real document or path
type PreviewRenderer ¶
PreviewRenderer renders a picker item's preview at the given size
type PromptComponent ¶
type PromptComponent struct {
// contains filtered or unexported fields
}
func (*PromptComponent) HandleEvent ¶
func (p *PromptComponent) HandleEvent( cx *Context, msg tea.Msg, ) (EventResult, tea.Cmd)
func (*PromptComponent) PaintBuffer ¶
type SkipPickerPathArgs ¶
type SkipPickerPathArgs struct {
Rel string
Path string
Entry os.DirEntry
Ignores []PickerIgnore
Opts PickerIgnoreOptions
}
SkipPickerPathArgs holds the entry a picker file-walk is considering and the ignore state to test it against
type StaticPickerSource ¶
type StaticPickerSource interface {
PickerSource
PrepareMatcher(query string) PickerMatcher
}
StaticPickerSource extends PickerSource with fuzzy-match filtering
type TerminalPane ¶
type TerminalPane struct {
// contains filtered or unexported fields
}
TerminalPane is a view.Pane backed by a real PTY and a VT100/xterm emulator, so full-screen programs (editors, pagers, TUIs) render correctly
func NewTerminalPane ¶
NewTerminalPane spawns shell in a PTY and pumps its output into a VT emulator sized w by h
func NewTerminalPaneInDir ¶
func NewTerminalPaneInDir( e *view.Editor, shell, dir string, size geom.Size, ) (*TerminalPane, error)
NewTerminalPaneInDir spawns shell in dir
func (*TerminalPane) Area ¶
func (t *TerminalPane) Area() geom.Area
Area returns the screen rectangle assigned by the layout engine
func (*TerminalPane) BeginDrag ¶
BeginDrag starts a selection if the shell hasn't grabbed mouse tracking, or forwards the click to it otherwise
func (*TerminalPane) CancelDrag ¶
func (t *TerminalPane) CancelDrag()
CancelDrag stops any pending auto-scroll tick, without side effects
func (*TerminalPane) Close ¶
func (t *TerminalPane) Close()
Close terminates this terminal and closes its pane. The tree discards any panes stashed behind it when the node is removed
func (*TerminalPane) Closed ¶
func (t *TerminalPane) Closed() <-chan struct{}
Closed delivers a signal once the shell process has exited
func (*TerminalPane) ConsumeBell ¶
func (t *TerminalPane) ConsumeBell(focused bool) bool
ConsumeBell reports whether the bell has rung since it was last consumed. A rung bell only clears when read while focused, so it stays visible in the status line until the pane is actually looked at
func (*TerminalPane) ConsumeDirty ¶
func (t *TerminalPane) ConsumeDirty() bool
ConsumeDirty reports whether the pane has changed since the last call, clearing the flag
func (*TerminalPane) ContinueDrag ¶
ContinueDrag extends the selection to (x, y), auto-scrolling and scheduling further ticks if the drag has crossed the pane's top or bottom edge
func (*TerminalPane) Cursor ¶
func (t *TerminalPane) Cursor(cx *Context) (tea.Cursor, bool)
Cursor reports the shell's cursor position, translated to screen space
func (*TerminalPane) Discard ¶
func (t *TerminalPane) Discard()
Discard terminates this terminal when its slot is vacated without reverting
func (*TerminalPane) DragTick ¶
DragTick continues scrolling toward toTop if gen still matches the scheduling tick, or is a no-op if a newer drag has since superseded it
func (*TerminalPane) Emulator ¶
func (t *TerminalPane) Emulator() *vt.SafeEmulator
Emulator returns the underlying VT emulator for rendering and input
func (*TerminalPane) EndDrag ¶
EndDrag finalizes the selection at (x, y), copying it to the clipboard
func (*TerminalPane) HandleEvent ¶
func (t *TerminalPane) HandleEvent( cx *Context, msg tea.Msg, ) (EventResult, bool)
HandleEvent routes key and mouse events to the shell
func (*TerminalPane) IngestOutput ¶
func (t *TerminalPane) IngestOutput(data []byte)
IngestOutput applies a chunk of output as if it had just been read from the PTY, letting tests simulate shell output without a real child process
func (*TerminalPane) MarkDirty ¶
func (t *TerminalPane) MarkDirty()
MarkDirty flags the pane as needing a repaint on the next frame
func (*TerminalPane) Mode ¶
func (t *TerminalPane) Mode() view.Mode
Mode reports view.ModeTerminal, since a terminal pane has no insert/select/normal distinction
func (*TerminalPane) MouseEnabled ¶
func (t *TerminalPane) MouseEnabled() bool
MouseEnabled reports whether the program running in the shell has requested mouse tracking (e.g. vim, htop, tmux)
func (*TerminalPane) Paste ¶
func (t *TerminalPane) Paste(text string)
Paste sends text to the shell, bracketing it with paste-mode escapes if the running program requested bracketed paste
func (*TerminalPane) Path ¶
func (t *TerminalPane) Path() string
Path returns the shell working directory most recently reported by OSC 7
func (*TerminalPane) SaveSession ¶
func (t *TerminalPane) SaveSession(w *view.SessionWriter)
SaveSession stores a terminal slot so a fresh shell can be reopened
func (*TerminalPane) ScrollLines ¶
func (t *TerminalPane) ScrollLines(n int)
ScrollLines moves the view n lines back into scrollback (n < 0 moves toward live output); a no-op while the alt screen is active
func (*TerminalPane) ScrollOffset ¶
func (t *TerminalPane) ScrollOffset() int
ScrollOffset returns the number of lines scrolled back from live output
func (*TerminalPane) ScrollToBottom ¶
func (t *TerminalPane) ScrollToBottom()
ScrollToBottom returns the view to live output
func (*TerminalPane) SearchScrollback ¶
func (t *TerminalPane) SearchScrollback(pattern string) bool
SearchScrollback jumps to the nearest line above the current view containing pattern (case-insensitive), reporting whether one was found
func (*TerminalPane) SendKey ¶
func (t *TerminalPane) SendKey(k uv.KeyEvent)
SendKey forwards a key event to the shell. Printable text bypasses vt's encoder, which silently drops runes whose Mod is non-zero (e.g. shifted). Any keypress returns the view to live output, like a real terminal
func (*TerminalPane) SendMouse ¶
func (t *TerminalPane) SendMouse(m uv.MouseEvent)
SendMouse forwards a mouse event to the shell
func (*TerminalPane) SetArea ¶
func (t *TerminalPane) SetArea(a geom.Area)
SetArea updates the pane's screen rectangle and resizes the PTY and emulator to match, reflowing the shell
func (*TerminalPane) SetID ¶
func (t *TerminalPane) SetID(id view.Id)
SetID sets the pane identifier (called by the tree on insertion)
func (*TerminalPane) SetRedraw ¶ added in v0.1.10
func (t *TerminalPane) SetRedraw(fn func())
SetRedraw installs the hook the shell calls to wake the render loop when it mutates the pane off the event loop; the tree wires it on insertion
func (*TerminalPane) Shutdown ¶
func (t *TerminalPane) Shutdown()
Shutdown terminates this terminal, releasing its PTY
func (*TerminalPane) Split ¶
func (t *TerminalPane) Split() (view.Pane, error)
Split starts another terminal using the same shell
func (*TerminalPane) Stop ¶
func (t *TerminalPane) Stop() error
Stop terminates the shell process and releases the PTY
func (*TerminalPane) Title ¶
func (t *TerminalPane) Title() string
Title returns the terminal title most recently set by the shell or the program running in it (OSC 0/2), or "" if none has been set yet
Source Files
¶
- binary-pane.go
- binary-preview.go
- binary-render.go
- border.go
- clip-pad.go
- code-action-component.go
- completion-component.go
- completion-cursor.go
- completion-icons.go
- completion-match.go
- completion-refresh.go
- completion-row.go
- component.go
- compositor.go
- context.go
- doc-render-cache.go
- doc-render-colors.go
- doc-render-content.go
- doc-render-diagnostics.go
- doc-render-gutter.go
- doc-render-mouse.go
- doc-render-pass.go
- doc-render-row-cell.go
- doc-render-row-glyph.go
- doc-render-row-style.go
- doc-render-row.go
- doc-render-scan.go
- doc-render-spans.go
- doc-render.go
- editor-component-autoscroll.go
- editor-component-autosize.go
- editor-component.go
- editor-events.go
- editor-expand.go
- editor-keys.go
- editor-macro.go
- file-watch.go
- graphics-support.go
- hover-component.go
- image-pane.go
- image-render.go
- key-tea.go
- list-interaction.go
- model-action-lsp-goto.go
- model-action-lsp-picker.go
- model-action-lsp.go
- model-action-resize.go
- model-action-terminal.go
- model-action.go
- model-image.go
- model-typable.go
- model.go
- picker-columns.go
- picker-commands.go
- picker-component.go
- picker-content.go
- picker-draw.go
- picker-feed.go
- picker-frame.go
- picker-fuzzy.go
- picker-ignore.go
- picker-keys.go
- picker-lsp.go
- picker-match.go
- picker-options.go
- picker-preview-cache.go
- picker-preview-diff.go
- picker-preview-image.go
- picker-preview-render.go
- picker-preview.go
- picker-render-matched.go
- picker-selection.go
- picker-vcs.go
- picker.go
- popup.go
- prompt-complete.go
- prompt-component.go
- render-message.go
- render-status-elems.go
- render-status.go
- render-theme.go
- signature-component.go
- style.go
- terminal-input.go
- terminal-pane.go
- terminal-render.go
- text-popup.go