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, bool)
- 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 BufferOverlayComponent
- type BufferRenderer
- type Callback
- 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 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) 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 Model
- func (m Model) CmdModeAction() command.KeyAction
- func (m Model) CodeActionPickerAction() command.KeyAction
- func (m Model) CommandPaletteAction() command.KeyAction
- func (m Model) CompletionAction() command.KeyAction
- func (m Model) ExecTypable(input string) Model
- func (m Model) GotoDeclarationAction() command.KeyAction
- func (m Model) GotoDefinitionAction() command.KeyAction
- func (m Model) GotoImplementationAction() command.KeyAction
- func (m Model) GotoReferenceAction() command.KeyAction
- func (m Model) GotoTypeDefinitionAction() command.KeyAction
- func (m Model) HoverAction() command.KeyAction
- func (m Model) Init() tea.Cmd
- func (m Model) LastPickerAction() command.KeyAction
- 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.KeyAction
- func (m Model) PickerLayoutOptions() PickerLayoutOptions
- func (m Model) RegexAction(prompt string, fn promptHandler) command.KeyAction
- func (m Model) RenameSymbolAction() command.KeyAction
- func (m Model) ResizeViewAction(e *view.Editor) command.Continuation
- func (m Model) SearchAction(forward bool) command.KeyAction
- func (m Model) SelectReferencesAction() command.KeyAction
- func (m Model) SetPickerLayoutOptions(opts PickerLayoutOptions)
- func (m Model) ShellAction(prompt string, fn promptHandler) command.KeyAction
- func (m Model) SignatureHelpAction() command.KeyAction
- func (m Model) SymbolPickerAction() command.KeyAction
- func (m Model) TerminalAction() command.KeyAction
- func (m Model) TerminalSearchAction() command.KeyAction
- 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() command.KeyAction
- 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 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) Shutdown()
- func (t *TerminalPane) Split() (view.Pane, error)
- func (t *TerminalPane) Stop() error
- func (t *TerminalPane) Title() string
- func (t *TerminalPane) Updates() <-chan struct{}
Constants ¶
const ( // CompletionMode is the keymap mode used while the completion popup is // focused CompletionMode = "COM" // 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 ( 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 AcceptDocumentID ¶
func AcceptDocumentID( e *view.Editor, id view.DocumentId, action PickerAcceptAction, ) (*view.View, bool)
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, including ones stashed behind a replacement, so the process doesn't 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 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 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
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 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 click zooms in, a modified 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) 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 Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubbletea model — a thin wrapper around Compositor
func (Model) CmdModeAction ¶
func (Model) CodeActionPickerAction ¶
func (Model) CommandPaletteAction ¶
func (Model) CompletionAction ¶
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.KeyAction
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) 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) Match ¶
func (p PickerBase) Match(query string, item PickerItem) (int, []int, bool)
func (PickerBase) MatchColumn ¶
func (p PickerBase) MatchColumn() int
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 ¶
type PickerIgnoreOptions struct {
Hidden bool
Parents bool
Ignore bool
GitIgnore bool
GitGlobal bool
GitExclude bool
}
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 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
Match(query string, item PickerItem) (score int, indices []int, ok bool)
}
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
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 displaced terminal and everything behind it
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) Shutdown ¶
func (t *TerminalPane) Shutdown()
Shutdown terminates this terminal and terminals behind it
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
func (*TerminalPane) Updates ¶
func (t *TerminalPane) Updates() <-chan struct{}
Updates delivers a signal each time new output arrives from the shell
Source Files
¶
- 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.go
- editor-events.go
- editor-expand.go
- editor-file-watch.go
- editor-keys.go
- editor-macro.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-vcs.go
- picker.go
- popup.go
- prompt-complete.go
- prompt-component.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