Documentation
¶
Overview ¶
It provides a terminal model backed by a PTY and x/vt emulator.
KeyPressMsg flow ¶
This describes what happens when a user types a key and how it reaches the real terminal process.
1. Write to the shell
- User types a character and Bubble Tea generates a tea.KeyPressMsg.
- Model.Update forwards the message to x/vt key handling: tw.emu.SendKey(vt.KeyPressEvent(msg)).
- x/vt converts the key event into bytes and writes them into the emulator's internal output buffer (via io.WriteString(e.pw, seq)).
- This unblocks the writeShell goroutine, which is waiting on tw.emu.Read.
- writeShell writes those bytes to the PTY with tw.pty.Write(buf[:n]).
- The shell running on the other end of the PTY receives those bytes as stdin.
2. Read from the shell
This is the continuation of step 1.
- The shell processes the input and produces output (echo, command result, prompts, etc.).
- The shell writes that output back to the PTY.
- readShell reads from the PTY and receives the shell output bytes.
- A OutputMsg is created and sent back into Update.
- The output is written to the emulator and rendered in Bubble Tea.
Index ¶
- type ClosedMsg
- type Model
- func (m Model) Args() []string
- func (m Model) Blur() Model
- func (m *Model) Close()
- func (m Model) Closed() bool
- func (m Model) Command() string
- func (m Model) Cursor() *tea.Cursor
- func (m Model) Focus() Model
- func (m Model) Focused() bool
- func (m Model) Height() int
- func (m Model) ID() int
- func (m Model) Init() tea.Cmd
- func (m Model) PID() int
- func (m *Model) SetHeight(height int)
- func (m *Model) SetWidth(width int)
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
- func (m Model) Width() int
- type Option
- type OutputMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model embeds a shell in Bubble Tea using x/vt for emulation and xpty for the pseudo-terminal.
type Option ¶
type Option func(*Model)
func WithCommand ¶
func WithInitialHeight ¶
func WithInitialWidth ¶
func WithStdErr ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.
