Documentation
¶
Overview ¶
Package terminal implements the embedded terminal panel for grut. It provides a scrollable view of shell output with two modes: Normal mode for scrolling and Insert mode for typing commands.
Index ¶
- type Panel
- func (p *Panel) Close()
- func (p *Panel) Init(ctx context.Context) tea.Cmd
- func (p *Panel) Input() string
- func (p *Panel) KeyBindings() []panels.KeyBinding
- func (p *Panel) Mode() mode
- func (p *Panel) Offset() int
- func (p *Panel) Update(msg tea.Msg) (panels.Panel, tea.Cmd)
- func (p *Panel) View(width, height int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Panel ¶
Panel is the embedded terminal panel. It implements panels.Panel and panels.Closer. The panel wraps a term.Runner and provides two modes:
- Normal mode: j/k to scroll output, i/Enter to switch to insert mode.
- Insert mode: keystrokes are collected and sent to the shell on Enter. The configured prefix key (default ctrl+b) exits insert mode.
func New ¶
New creates a new terminal panel with the given config and backend runner. If runner is nil, the panel displays a placeholder until a runner is set.
func (*Panel) Close ¶
func (p *Panel) Close()
Close implements panels.Closer. Kills the shell process on shutdown.
func (*Panel) Init ¶
--------------------------------------------------------------------------- panels.Panel interface --------------------------------------------------------------------------- Init implements panels.Panel.
func (*Panel) KeyBindings ¶
func (p *Panel) KeyBindings() []panels.KeyBinding
KeyBindings implements panels.Panel.
func (*Panel) Mode ¶
func (p *Panel) Mode() mode
Mode returns the current input mode. Exported for testing.