Documentation
¶
Overview ¶
Package uv implements Kite's terminal backend using Ultraviolet to render frames and receive input from a terminal. New() uses the default terminal. Pass WithInput and WithOutput to New to use session streams, WithEnviron to replace the process environment, and WithSize for initial PTY dimensions. For example, after accepting an SSH session with a PTY:
b, err := uv.New(uv.WithInput(session), uv.WithOutput(session),
uv.WithEnviron([]string{"TERM=" + pty.Term}),
uv.WithSize(pty.Window.Width, pty.Window.Height))
if err != nil { return err }
Forward each SSH window change with b.NotifyResize(win.Width, win.Height). NotifyResize is safe on another goroutine, including during shutdown. For blocking non-file streams, provide an io.ReadCloser whose Close unblocks Read. Restore may close that input after writing terminal reset sequences.
Index ¶
- type Backend
- func (b *Backend) BeginFrame() backend.Surface
- func (b *Backend) Bell()
- func (b *Backend) Caps() backend.Caps
- func (b *Backend) Clear()
- func (b *Backend) Clipboard() backend.Clipboard
- func (b *Backend) DumpState()
- func (b *Backend) EndFrame() error
- func (b *Backend) Events() <-chan backend.RawEvent
- func (b *Backend) ExecIO() (io.Reader, io.Writer, io.Writer)
- func (b *Backend) InsertAbove(buf *backend.Buffer)
- func (b *Backend) InsertAboveForFrame(buf *backend.Buffer)
- func (b *Backend) NotifyResize(width, height int)
- func (b *Backend) Resize(size geom.Size)
- func (b *Backend) Restore()
- func (b *Backend) Resume() error
- func (b *Backend) SetCursorColor(c color.Color)
- func (b *Backend) SetCursorPos(x, y int)
- func (b *Backend) SetCursorShape(s backend.CursorShape)
- func (b *Backend) SetInline(inline bool)
- func (b *Backend) SetMouseMode(mode backend.MouseSupport)
- func (b *Backend) SetProgramResume(resume *terminal.ProgramResume)
- func (b *Backend) SetProgramStatus(status *terminal.ProgramStatus)
- func (b *Backend) SetProgressBar(state backend.ProgressBarState, percentage int)
- func (b *Backend) SetResizeHandler(fn func(geom.Size))
- func (b *Backend) SetTitle(s string)
- func (b *Backend) ShowCursor(v bool)
- func (b *Backend) Size() geom.Size
- func (b *Backend) Start() error
- func (b *Backend) Stop()
- func (b *Backend) Suspend() error
- func (b *Backend) Title() string
- func (b *Backend) Write(p []byte) (n int, err error)
- func (b *Backend) Writer() io.Writer
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is the ultraviolet terminal backend for kite/x. It owns a uv.Terminal for input and a uv.TerminalScreen for output. EndFrame copies the painted Buffer to the TerminalScreen and signals the render goroutine to diff and flush.
func (*Backend) BeginFrame ¶
BeginFrame allocates a fresh Buffer for the current terminal size.
func (*Backend) Clear ¶
func (b *Backend) Clear()
Clear queues a terminal reset before subsequent inserts and frames.
func (*Backend) InsertAbove ¶
InsertAbove inserts a rendered cell buffer permanently into the terminal scrollback above the active inline frame.
func (*Backend) InsertAboveForFrame ¶
InsertAboveForFrame queues static output without restoring a stale live frame. The engine commits the newly reconciled live frame after these inserts.
func (*Backend) NotifyResize ¶
NotifyResize reports a PTY window change. Pending changes may be coalesced.
func (*Backend) SetCursorColor ¶
func (*Backend) SetCursorPos ¶
func (*Backend) SetCursorShape ¶
func (b *Backend) SetCursorShape(s backend.CursorShape)
func (*Backend) SetMouseMode ¶
func (b *Backend) SetMouseMode(mode backend.MouseSupport)
SetMouseMode selects the mouse events reported by the terminal.
func (*Backend) SetProgramResume ¶
func (b *Backend) SetProgramResume(resume *terminal.ProgramResume)
func (*Backend) SetProgramStatus ¶
func (b *Backend) SetProgramStatus(status *terminal.ProgramStatus)
func (*Backend) SetProgressBar ¶
func (b *Backend) SetProgressBar(state backend.ProgressBarState, percentage int)
func (*Backend) SetResizeHandler ¶
SetResizeHandler registers fn as the callback invoked when the terminal is resized.
func (*Backend) ShowCursor ¶
type Option ¶
type Option func(*consoleOptions)
Option configures a single UV backend.
func WithEnviron ¶
WithEnviron replaces the process environment, including when environ is empty.