ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWidth            = 80
	DefaultHeight           = 24
	OPEN_ALT                = "\x1b[?1049h"
	CLOSE_ALT               = "\x1b[?1049l"
	HIDE_CURSOR             = "\x1b[?25l"
	SHOW_CURSOR             = "\x1b[?25h"
	ENABLE_MOUSE            = "\x1b[?1000h\x1b[?1002h\x1b[?1006h"
	DISABLE_MOUSE           = "\x1b[?1006l\x1b[?1002l\x1b[?1000l"
	ENABLE_BRACKETED_PASTE  = "\x1b[?2004h"
	DISABLE_BRACKETED_PASTE = "\x1b[?2004l"
	// Ask compatible terminals to distinguish modified keys like Shift+Enter.
	ENABLE_KITTY_KEYBOARD     = "\x1b[>1u"
	DISABLE_KITTY_KEYBOARD    = "\x1b[<u"
	ENABLE_MODIFY_OTHER_KEYS  = "\x1b[>4;2m"
	DISABLE_MODIFY_OTHER_KEYS = "\x1b[>4;0m"
	CLEAR_SCREEN              = "\x1b[2J"
	MOVE_CURSOR               = "\x1b[H"
)

Variables

View Source
var ErrNotTerminal = errors.New("stdin is not a terminal")

Functions

This section is empty.

Types

type Terminal

type Terminal struct {
	W, H int
	// contains filtered or unexported fields
}

func NewTerminal

func NewTerminal(fd int) *Terminal

func (*Terminal) Enter

func (t *Terminal) Enter() error

func (*Terminal) Exit

func (t *Terminal) Exit()

func (*Terminal) RefreshSize

func (t *Terminal) RefreshSize() error

type TmuxKeys

type TmuxKeys struct {
	// contains filtered or unexported fields
}

TmuxKeys manages tmux's server-wide extended-keys option for the lifetime of the app. plums asks the terminal to distinguish modified keys like Shift+Enter (CSI-u / modifyOtherKeys), but tmux only forwards those to the application when extended-keys is enabled; with the common default of "off" Shift+Enter arrives as a bare Enter, which inserts a newline instead of submitting in split layout. EnableTmuxExtendedKeys turns it on at startup and Restore puts the prior value back on exit.

func EnableTmuxExtendedKeys

func EnableTmuxExtendedKeys() *TmuxKeys

EnableTmuxExtendedKeys enables tmux extended-keys when running inside tmux and the option is not already on. It returns a handle whose Restore method undoes the change; both are no-ops outside tmux or when tmux is unavailable.

func (*TmuxKeys) Restore

func (k *TmuxKeys) Restore()

Restore reverts the extended-keys option to its prior value if this handle changed it.

Directories

Path Synopsis
tui
theme
Package theme is the single source of truth for the TUI colour palette.
Package theme is the single source of truth for the TUI colour palette.

Jump to

Keyboard shortcuts

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