Documentation
¶
Overview ¶
Package ui implements the Bubbletea terminal application model for toe
Index ¶
- Constants
- Variables
- func CloseAllTerminalPanes(e *view.Editor)
- func CompletionModule(model Model) command.Module
- func DiagnosticMessageText(message string) string
- func FromTeaKey(k tea.KeyPressMsg) command.KeyEvent
- func GotoDocument(e *view.Editor, id view.DocumentId, sel GotoSelector, ...) (*view.View, bool)
- func GotoJump(e *view.Editor, index int, accept PickerAcceptAction) (*view.View, bool)
- func GotoPath(e *view.Editor, path string, sel GotoSelector, accept PickerAcceptAction) (*view.View, bool)
- func NewTokenExpander(e *view.Editor) command.TokenExpander
- func OpenPath(e *view.Editor, path string, action PickerAcceptAction) (*view.View, bool, error)
- func PickerNamePath(rel string) (string, int)
- func PickerTrailingPath(text, rel string) (string, int)
- func SkipPickerPath(args SkipPickerPathArgs) bool
- func SortPickerItems(items []*PickerItem)
- func TrueColorSupported() bool
- type BinaryPane
- func (p *BinaryPane) Area() geom.Area
- 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(_ *view.Editor) command.Continuation
- func (e *EditorComponent) Render(cx *Context, screen geom.Size) *tui.Buffer
- type EventResult
- type FileBackedPickerSource
- type GotoSelector
- type IgnoreTarget
- type Image
- type ImagePane
- func (p *ImagePane) Area() geom.Area
- 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) AboutAction(_ *view.Editor)
- func (m Model) Animation() bool
- func (m Model) AutoSize() bool
- 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) CommandPalettePicker(e *view.Editor) *Picker
- 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 i18n.Key, 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) SetCompletionOptions(opts CompletionOptions)
- func (m Model) SetPickerLayoutOptions(opts PickerLayoutOptions)
- func (m Model) ShellAction(prompt i18n.Key, 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(cx *Context, _ geom.Size) (cur tea.Cursor, ok bool)
- func (p *PickerComponent) HandleEvent(cx *Context, msg tea.Msg) (EventResult, tea.Cmd)
- func (p *PickerComponent) Layout(cx *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 PickerItemSlab
- type PickerLayoutOptions
- type PickerLoad
- 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 SnapshotPickerSource
- 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) Closed() <-chan struct{}
- func (t *TerminalPane) ConsumeBell(focused bool) bool
- func (t *TerminalPane) ConsumeDirty() bool
- func (t *TerminalPane) ConsumeNotifications() []string
- 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, toLow 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) HoldResize()
- 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) ResumeResize()
- 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
- type TerminalPaneArgs
Constants ¶
const ( AboutVersion i18n.Key = "about.version" AboutDevelopment i18n.Key = "about.development" )
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 is the automatic completion threshold DefaultCompletionTriggerLen = 2 )
const ( DefaultPickerSplitRatio = 0.5 MinPickerSplitRatio = 0.2 MaxPickerSplitRatio = 0.8 )
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 CloseAllTerminalPanes ¶
CloseAllTerminalPanes kills every open terminal's shell so the process does not orphan them on exit
func CompletionModule ¶ added in v0.2.1
CompletionModule returns the completion-popup navigation commands. It lives beside completionComponent because the popup implements every action here by intercepting the resolved command name
func DiagnosticMessageText ¶ added in v0.2.4
DiagnosticMessageText flattens a server's message onto one line and shortens the qualified names in it
func FromTeaKey ¶
func FromTeaKey(k tea.KeyPressMsg) command.KeyEvent
FromTeaKey converts a Bubbletea v2 KeyPressMsg to a KeyEvent
func GotoDocument ¶ added in v0.3.2
func GotoDocument( e *view.Editor, id view.DocumentId, sel GotoSelector, accept PickerAcceptAction, ) (*view.View, bool)
GotoDocument navigates the pane to an open document, placing the selection the selector resolves and scrolling it into view
func GotoJump ¶ added in v0.3.2
GotoJump navigates to the jump list entry at index, moving the list head onto it instead of recording a new jump, so the history either side of it survives. A split accept opens a new pane and records a jump as usual
func GotoPath ¶ added in v0.3.2
func GotoPath( e *view.Editor, path string, sel GotoSelector, accept PickerAcceptAction, ) (*view.View, bool)
GotoPath navigates the pane to a file, switching to it when it is already open, placing the selection the selector resolves and scrolling it into view. Image and binary files open as their own panes and take no selection
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 PickerNamePath ¶ added in v0.2.4
PickerNamePath renders a path name-first, trailing the directory holding it, and returns the rune offset where that directory begins
func PickerTrailingPath ¶ added in v0.2.4
PickerTrailingPath trails a path behind a row's own text, and returns the rune offset where that path begins
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 sort key, falling back to display text, the default ordering for static picker sources
func TrueColorSupported ¶ added in v0.1.35
func TrueColorSupported() bool
TrueColorSupported reports whether the terminal can render 24-bit color, based on well-known environment variables
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) 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
}
Compositor manages the editor's layered components
func (*Compositor) Cursor ¶
func (c *Compositor) Cursor(cx *Context) (cur tea.Cursor, ok bool)
Cursor returns the cursor of the topmost layer that wants one
func (*Compositor) HandleEvent ¶
HandleEvent offers a message to each layer from the top down
func (*Compositor) Push ¶
func (c *Compositor) Push(layer Component)
Push adds a layer above the current top
func (*Compositor) Render ¶
func (c *Compositor) Render(cx *Context) string
Render paints every layer bottom up into one frame
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, toLow 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)
HandleEvent routes keys, mouse, and editor messages to the panes
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( _ *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 GotoSelector ¶ added in v0.3.2
GotoSelector resolves the selection to place once the destination document is open; a nil selector leaves the document's selection alone
func GotoLines ¶ added in v0.3.2
func GotoLines(lines *core.Span) GotoSelector
GotoLines returns a selector covering the first line of lines
func GotoSelection ¶ added in v0.3.2
func GotoSelection(sel core.Selection) GotoSelector
GotoSelection returns a selector that always resolves to sel
type IgnoreTarget ¶ added in v0.2.0
IgnoreTarget is the walk root and the path being tested against the ignore rules that apply to it
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) PanDown ¶ added in v0.1.3
func (p *ImagePane) PanDown()
PanDown shifts the viewport one step down
func (*ImagePane) PanLeft ¶ added in v0.1.3
func (p *ImagePane) PanLeft()
PanLeft shifts the viewport one step left
func (*ImagePane) PanRight ¶ added in v0.1.3
func (p *ImagePane) PanRight()
PanRight shifts the viewport one step right
func (*ImagePane) PanUp ¶ added in v0.1.3
func (p *ImagePane) PanUp()
PanUp shifts the viewport one step up
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) AboutAction ¶ added in v0.2.0
AboutAction opens the about popup
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 panes widen to fit their content
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 ¶
CmdModeAction opens the command prompt
func (Model) CodeActionPickerAction ¶
CodeActionPickerAction opens a menu of code actions at the cursor
func (Model) CommandPaletteAction ¶
CommandPaletteAction opens the command palette
func (Model) CommandPalettePicker ¶ added in v0.3.0
CommandPalettePicker opens a picker listing all registered commands
func (Model) CompletionAction ¶
CompletionAction requests completions at the cursor
func (Model) CompletionOptions ¶ added in v0.1.13
func (m Model) CompletionOptions() CompletionOptions
CompletionOptions returns the UI-owned automatic completion settings
func (Model) ExecTypable ¶
ExecTypable runs a typed command line, reporting unknown commands
func (Model) GotoDeclarationAction ¶
GotoDeclarationAction jumps to the declaration of the symbol at the cursor
func (Model) GotoDefinitionAction ¶
GotoDefinitionAction jumps to the definition of the symbol at the cursor
func (Model) GotoImplementationAction ¶
GotoImplementationAction jumps to implementations of the symbol at the cursor
func (Model) GotoReferenceAction ¶
GotoReferenceAction lists references to the symbol at the cursor
func (Model) GotoTypeDefinitionAction ¶
GotoTypeDefinitionAction jumps to the type of the symbol at the cursor
func (Model) HoverAction ¶
HoverAction requests documentation for the symbol at the cursor
func (Model) LastPickerAction ¶
LastPickerAction reopens the picker used most recently
func (Model) MacroRecordAction ¶
func (m Model) MacroRecordAction(e *view.Editor) command.Continuation
MacroRecordAction starts or stops recording a macro
func (Model) MacroReplayAction ¶
func (m Model) MacroReplayAction(e *view.Editor) command.Continuation
MacroReplayAction replays the recorded macro
func (Model) PickerAction ¶
func (m Model) PickerAction(fn PickerFunc) command.Action
PickerAction returns an action opening the picker fn builds
func (Model) PickerLayoutOptions ¶
func (m Model) PickerLayoutOptions() PickerLayoutOptions
PickerLayoutOptions returns the UI-owned picker layout settings
func (Model) RegexAction ¶
RegexAction returns an action prompting for a pattern, then running fn
func (Model) RenameSymbolAction ¶
RenameSymbolAction prompts for a new name and applies the server's edits
func (Model) ResizeViewAction ¶
func (m Model) ResizeViewAction(e *view.Editor) command.Continuation
ResizeViewAction starts interactive split resizing
func (Model) SearchAction ¶
SearchAction returns an action opening the search prompt
func (Model) SelectReferencesAction ¶
SelectReferencesAction selects every reference to the symbol at the cursor
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 panes widen to fit their content
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 ¶
ShellAction returns an action prompting for a command, then running fn
func (Model) SignatureHelpAction ¶
SignatureHelpAction requests parameter hints for the call at the cursor
func (Model) SymbolPickerAction ¶
SymbolPickerAction opens a picker over the focused document's symbols
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
WithInitialPicker returns a model that opens a picker on start
func (Model) WithStartupCmd ¶
WithStartupCmd returns a model that runs cmd once on start
func (Model) WithStartupMessage ¶
WithStartupMessage sets a status bar message for the first frame
func (Model) WorkspaceSymbolPickerAction ¶
WorkspaceSymbolPickerAction opens a picker over workspace symbols
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 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 ¶
PickerBase is an optional starting point a source can embed for default id, title, column, and fuzzy-match behavior; a source is free to implement those methods itself instead
func (PickerBase) ColumnProportions ¶
func (p PickerBase) ColumnProportions() []int
ColumnProportions are the relative widths of the columns
func (PickerBase) Columns ¶
func (p PickerBase) Columns() []string
Columns are the picker's column headings
func (PickerBase) ID ¶
func (p PickerBase) ID() string
ID is the picker's identifier, used to restore the last picker
func (PickerBase) MatchColumn ¶
func (p PickerBase) MatchColumn() int
MatchColumn is the column the filter query matches against
func (PickerBase) PrepareMatcher ¶ added in v0.1.19
func (p PickerBase) PrepareMatcher(query string) PickerMatcher
PrepareMatcher prepares a query for matching multiple items
func (PickerBase) Title ¶ added in v0.1.41
func (p PickerBase) Title() string
Title is the picker's display title, drawn in the frame's top border
type PickerComponent ¶
type PickerComponent struct {
// contains filtered or unexported fields
}
PickerComponent renders and handles an interactive picker
func (*PickerComponent) HandleEvent ¶
func (p *PickerComponent) HandleEvent( cx *Context, msg tea.Msg, ) (EventResult, tea.Cmd)
HandleEvent drives filtering, selection, and acceptance
func (*PickerComponent) PaintBuffer ¶
PaintBuffer draws the picker list, its input, and any preview
type PickerFunc ¶
PickerFunc constructs a Picker from the editor
type PickerIgnore ¶
type PickerIgnore struct {
// contains filtered or unexported fields
}
func LoadIgnoreFiles ¶
func LoadIgnoreFiles( target IgnoreTarget, opts PickerIgnoreOptions, ) []PickerIgnore
LoadIgnoreFiles collects .ignore, .toe/ignore, and .gitignore rules that apply to path, nearest directory last
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
SecFrom int
SortKey string
Group int
Section bool
Directory bool
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. A Section row labels the group its Group ordinal names; it never matches a query and the cursor skips it
type PickerItemSlab ¶ added in v0.1.38
type PickerItemSlab = core.Slab[PickerItem]
PickerItemSlab is a Slab specialized for PickerItem
type PickerLayoutOptions ¶
type PickerLayoutOptions struct {
SplitRatios map[string]float64 `toml:"split"`
Scales map[string]float64 `toml:"scales"`
}
PickerLayoutOptions holds the per-overlay list/preview split ratios and size scales, keyed by picker or prompt id
func (PickerLayoutOptions) SplitRatioFor ¶
func (o PickerLayoutOptions) SplitRatioFor(key string) float64
SplitRatioFor returns the saved split ratio for a picker key
type PickerLoad ¶ added in v0.2.0
type PickerLoad struct {
Items []*PickerItem
Feed <-chan *PickerItem
Stop StopFunc
}
PickerLoad is what a source returns from Load: the rows known up front, an optional channel of rows discovered asynchronously, and the cancel for that feed
type PickerLocation ¶
type PickerLocation struct {
Target PickerTarget
Lines *core.Span
}
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
Title() string
Columns() []string
MatchColumn() int
ColumnProportions() []int
Load(*view.Editor) PickerLoad
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
}
PromptComponent renders and handles an interactive prompt
func (*PromptComponent) HandleEvent ¶
func (p *PromptComponent) HandleEvent( cx *Context, msg tea.Msg, ) (EventResult, tea.Cmd)
HandleEvent drives editing, history, and completion of the input line
func (*PromptComponent) PaintBuffer ¶
PaintBuffer draws the prompt popup, its input line and its completions
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 SnapshotPickerSource ¶ added in v0.1.36
type SnapshotPickerSource interface {
PickerSource
Items(e *view.Editor) []*PickerItem
}
SnapshotPickerSource returns its whole row set synchronously, so a refresh can replace the list without a visible rebuild
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, args TerminalPaneArgs, ) (*TerminalPane, error)
NewTerminalPaneInDir spawns the shell in the given directory
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) 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) ConsumeNotifications ¶ added in v0.3.2
func (t *TerminalPane) ConsumeNotifications() []string
ConsumeNotifications returns the desktop notifications the shell has requested since the last call, clearing them
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 toLow 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) HoldResize ¶ added in v0.2.4
func (t *TerminalPane) HoldResize()
HoldResize defers PTY resizing until TerminalPane.ResumeResize, since a shell redraws its prompt on every SIGWINCH, and a storm of them leaves multi-line prompts stacked up the scrollback
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) ResumeResize ¶ added in v0.2.4
func (t *TerminalPane) ResumeResize()
ResumeResize re-enables PTY resizing, pushing the size the pane reached while held
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, unless resizing is held
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
¶
- about-component.go
- binary-pane.go
- binary-preview.go
- binary-render.go
- clip-pad.go
- code-action-component.go
- color-support.go
- completion-component.go
- completion-cursor.go
- completion-icons.go
- completion-match.go
- completion-module.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-autoscroll.go
- editor-autosize.go
- editor-component.go
- editor-events.go
- editor-expand.go
- editor-keys.go
- editor-macro.go
- file-watch.go
- goto.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
- overlay-resize.go
- pane-resize-hold.go
- picker-columns.go
- picker-commands.go
- picker-component.go
- picker-content.go
- picker-draw.go
- picker-feed.go
- picker-file-icon-catalog.go
- picker-file-icons.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-selection.go
- picker-vcs.go
- picker.go
- popup.go
- prompt-complete.go
- prompt-component.go
- render-matched.go
- render-message.go
- render-status-elems.go
- render-status.go
- render-theme.go
- signature-component.go
- status-row.go
- style.go
- term-match.go
- terminal-input.go
- terminal-pane.go
- terminal-render.go
- text-popup.go
- toast.go