terminal

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Panel

type Panel struct {
	panels.BasePanel
	// contains filtered or unexported fields
}

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

func New(cfg config.TerminalConfig, runner term.Runner, shell string) *Panel

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

func (p *Panel) Init(ctx context.Context) tea.Cmd

--------------------------------------------------------------------------- panels.Panel interface --------------------------------------------------------------------------- Init implements panels.Panel.

func (*Panel) Input

func (p *Panel) Input() string

Input returns the current input buffer contents. Exported for testing.

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.

func (*Panel) Offset

func (p *Panel) Offset() int

Offset returns the current scroll offset. Exported for testing.

func (*Panel) Update

func (p *Panel) Update(msg tea.Msg) (panels.Panel, tea.Cmd)

Update implements panels.Panel.

func (*Panel) View

func (p *Panel) View(width, height int) string

View implements panels.Panel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL