Documentation
¶
Index ¶
- Constants
- Variables
- func CursorShape(shape CursorShapes, blink bool) string
- func EscapeCodeToSetWindowTitle(title string) string
- func FullKeyboardProtocol(self *Loop)
- func MouseTrackingMode(self *Loop, mt MouseTracking)
- func NoAlternateScreen(self *Loop)
- func NoInBandResizeNotifications(self *Loop)
- func NoKeyboardStateChange(self *Loop)
- func NoMouseTracking(self *Loop)
- func NoRestoreColors(self *Loop)
- func OnlyDisambiguateKeys(self *Loop)
- type CursorShapes
- type DefaultColor
- type EscapeCodeType
- type IdType
- type KeyEvent
- func (self *KeyEvent) AsCSI() string
- func (self *KeyEvent) HasCapsLock() bool
- func (self *KeyEvent) Matches(spec string, event_type KeyEventType) bool
- func (self *KeyEvent) MatchesCaseInsensitiveTextOrKey(spec string) bool
- func (self *KeyEvent) MatchesCaseSensitiveTextOrKey(spec string) bool
- func (self *KeyEvent) MatchesParsedShortcut(ps *ParsedShortcut, event_type KeyEventType) bool
- func (self *KeyEvent) MatchesPressOrRepeat(spec string) bool
- func (self *KeyEvent) MatchesRelease(spec string) bool
- func (self *KeyEvent) String() string
- type KeyEventType
- type KeyModifiers
- type KeyboardStateBits
- type Loop
- func (self *Loop) AddTimer(interval time.Duration, repeats bool, callback TimerCallback) (IdType, error)
- func (self *Loop) AllowLineWrapping(allow bool)
- func (self *Loop) Beep()
- func (self *Loop) CallSoon(callback TimerCallback) (IdType, error)
- func (self *Loop) ClearPointerShapes() (ans []PointerShape)
- func (self *Loop) ClearScreen()
- func (self *Loop) ClearScreenButNotGraphics()
- func (self *Loop) ClearToEndOfLine()
- func (self *Loop) ClearToEndOfScreen()
- func (self *Loop) CopyTextToClipboard(text string)
- func (self *Loop) CopyTextToPrimarySelection(text string)
- func (self *Loop) CurrentPointerShape() (ans PointerShape, has_shape bool)
- func (self *Loop) DeathSignalName() string
- func (self *Loop) DebugPrintln(args ...any)
- func (self *Loop) EndAtomicUpdate()
- func (self *Loop) EndBracketedPaste()
- func (self *Loop) ExitCode() int
- func (self *Loop) FullKeyboardProtocol() *Loop
- func (self *Loop) IsAtomicUpdateActive() bool
- func (self *Loop) KillIfSignalled()
- func (self *Loop) MouseTrackingMode(mt MouseTracking) *Loop
- func (self *Loop) MoveCursorHorizontally(amt int)
- func (self *Loop) MoveCursorTo(x, y int)
- func (self *Loop) MoveCursorVertically(amt int)
- func (self *Loop) NoAlternateScreen() *Loop
- func (self *Loop) NoKeyboardStateChange() *Loop
- func (self *Loop) NoMouseTracking() *Loop
- func (self *Loop) NoRestoreColors() *Loop
- func (self *Loop) OnlyDisambiguateKeys() *Loop
- func (self *Loop) PopPointerShape()
- func (self *Loop) PrintStyled(style string, args ...any)
- func (self *Loop) Printf(format string, args ...any)
- func (self *Loop) Println(args ...any)
- func (self *Loop) PushPointerShape(s PointerShape)
- func (self *Loop) QueryTerminal(fields ...string) IdType
- func (self *Loop) QueueWriteBytesCopy(data []byte) IdType
- func (self *Loop) QueueWriteString(data string) IdType
- func (self *Loop) Quit(exit_code int)
- func (self *Loop) RemoveTimer(id IdType) bool
- func (self *Loop) RestoreCursorPosition()
- func (self *Loop) Run() (err error)
- func (self *Loop) SaveCursorPosition()
- func (self *Loop) ScreenSize() (ScreenSize, error)
- func (self *Loop) SendOverlayReady()
- func (self *Loop) SetCursorShape(shape CursorShapes, blink bool)
- func (self *Loop) SetCursorVisible(visible bool)
- func (self *Loop) SetDefaultColor(which DefaultColor, val style.RGBA)
- func (self *Loop) SetWindowTitle(title string)
- func (self *Loop) SprintStyled(style string, args ...any) string
- func (self *Loop) StartAtomicUpdate()
- func (self *Loop) StartBracketedPaste()
- func (self *Loop) StyleRectangle(style string, start_x, start_y, end_x, end_y int) IdType
- func (self *Loop) StyleRegion(style string, start_x, start_y, end_x, end_y int) IdType
- func (self *Loop) UnsafeQueueWriteBytes(data []byte) IdType
- func (self *Loop) WakeupMainThread() bool
- type Mode
- type MouseButtonFlag
- type MouseEvent
- type MouseEventType
- type MouseTracking
- type ParsedShortcut
- type PointerShape
- type ScreenSize
- type TerminalStateOptions
- type TimerCallback
Constants ¶
View Source
const ( SHIFT_INDICATOR int = 1 << 2 ALT_INDICATOR = 1 << 3 CTRL_INDICATOR = 1 << 4 MOTION_INDICATOR = 1 << 5 )
View Source
const ( LEGACY_KEYS KeyboardStateBits = 0 DISAMBIGUATE_KEYS = 1 REPORT_KEY_EVENT_TYPES = 2 REPORT_ALTERNATE_KEYS = 4 REPORT_ALL_KEYS_AS_ESCAPE_CODES = 8 REPORT_TEXT_WITH_KEYS = 16 FULL_KEYBOARD_PROTOCOL = DISAMBIGUATE_KEYS | REPORT_ALTERNATE_KEYS | REPORT_ALL_KEYS_AS_ESCAPE_CODES | REPORT_TEXT_WITH_KEYS | REPORT_KEY_EVENT_TYPES NO_KEYBOARD_STATE_CHANGE = 32 )
View Source
const ( SAVE_CURSOR = "\0337" RESTORE_CURSOR = "\0338" SAVE_PRIVATE_MODE_VALUES = "\033[?s" RESTORE_PRIVATE_MODE_VALUES = "\033[?r" SAVE_COLORS = "\033[#P" RESTORE_COLORS = "\033[#Q" DECSACE_DEFAULT_REGION_SELECT = "\033[*x" CLEAR_SCREEN = "\033[H\033[2J" )
View Source
const MoveCursorToTemplate = "\x1b[%d;%dH"
Variables ¶
View Source
var SIGNULL unix.Signal
Functions ¶
func CursorShape ¶
func CursorShape(shape CursorShapes, blink bool) string
func FullKeyboardProtocol ¶
func FullKeyboardProtocol(self *Loop)
func MouseTrackingMode ¶
func MouseTrackingMode(self *Loop, mt MouseTracking)
func NoAlternateScreen ¶
func NoAlternateScreen(self *Loop)
func NoInBandResizeNotifications ¶
func NoInBandResizeNotifications(self *Loop)
func NoKeyboardStateChange ¶
func NoKeyboardStateChange(self *Loop)
func NoMouseTracking ¶
func NoMouseTracking(self *Loop)
func NoRestoreColors ¶
func NoRestoreColors(self *Loop)
func OnlyDisambiguateKeys ¶
func OnlyDisambiguateKeys(self *Loop)
Types ¶
type CursorShapes ¶
type CursorShapes uint
const ( BLOCK_CURSOR CursorShapes = 1 UNDERLINE_CURSOR CursorShapes = 3 BAR_CURSOR CursorShapes = 5 )
type DefaultColor ¶
type DefaultColor int
const ( BACKGROUND DefaultColor = 11 FOREGROUND DefaultColor = 10 CURSOR DefaultColor = 12 SELECTION_BG DefaultColor = 17 SELECTION_FG DefaultColor = 19 )
type EscapeCodeType ¶
type EscapeCodeType int
const ( CSI EscapeCodeType = iota DCS OSC APC SOS PM )
type KeyEvent ¶
type KeyEvent struct { Type KeyEventType Mods KeyModifiers Key string ShiftedKey string AlternateKey string Text string Handled bool // The CSI string this key event was decoded from. Empty if not decoded from CSI. CSI string }
func KeyEventFromCSI ¶
func (*KeyEvent) HasCapsLock ¶
func (*KeyEvent) MatchesCaseInsensitiveTextOrKey ¶
func (*KeyEvent) MatchesCaseSensitiveTextOrKey ¶
func (*KeyEvent) MatchesParsedShortcut ¶
func (self *KeyEvent) MatchesParsedShortcut(ps *ParsedShortcut, event_type KeyEventType) bool
func (*KeyEvent) MatchesPressOrRepeat ¶
func (*KeyEvent) MatchesRelease ¶
type KeyEventType ¶
type KeyEventType uint8
const ( PRESS KeyEventType = 1 REPEAT KeyEventType = 2 RELEASE KeyEventType = 4 )
func (KeyEventType) String ¶
func (self KeyEventType) String() string
type KeyModifiers ¶
type KeyModifiers uint16
const ( SHIFT KeyModifiers = 1 ALT KeyModifiers = 2 CTRL KeyModifiers = 4 SUPER KeyModifiers = 8 HYPER KeyModifiers = 16 META KeyModifiers = 32 CAPS_LOCK KeyModifiers = 64 NUM_LOCK KeyModifiers = 128 )
func (KeyModifiers) HasCapsLock ¶
func (self KeyModifiers) HasCapsLock() bool
func (KeyModifiers) String ¶
func (self KeyModifiers) String() string
func (KeyModifiers) WithoutLocks ¶
func (self KeyModifiers) WithoutLocks() KeyModifiers
type KeyboardStateBits ¶
type KeyboardStateBits uint8
type Loop ¶
type Loop struct { // Suspend the loop restoring terminal state, and run the provided function. When it returns terminal state is // put back to what it was before suspending unless the function returns an error or an error occurs saving/restoring state. SuspendAndRun func(func() error) error // Called when the terminal has been fully setup. Any string returned is sent to // the terminal on shutdown OnInitialize func() (string, error) // Called just before the loop shuts down. Any returned string is written to the terminal before // shutdown OnFinalize func() string // Called when a key event happens OnKeyEvent func(event *KeyEvent) error // Called when a mouse event happens OnMouseEvent func(event *MouseEvent) error // Called when text is received either from a key event or directly from the terminal // Called with an empty string when bracketed paste ends OnText func(text string, from_key_event bool, in_bracketed_paste bool) error // Called when the terminal is resized OnResize func(old_size ScreenSize, new_size ScreenSize) error // Called when writing is done OnWriteComplete func(msg_id IdType, has_pending_writes bool) error // Called when a response to an rc command is received OnRCResponse func(data []byte) error // Called when a response to a query command is received OnQueryResponse func(key, val string, valid bool) error // Called when any input from tty is received OnReceivedData func(data []byte) error // Called when an escape code is received that is not handled by any other handler OnEscapeCode func(EscapeCodeType, []byte) error // Called when resuming from a SIGTSTP or Ctrl-z OnResumeFromStop func() error // Called when main loop is woken up OnWakeup func() error // Called on SIGINT return true if you wish to handle it yourself OnSIGINT func() (bool, error) // Called on SIGTERM return true if you wish to handle it yourself OnSIGTERM func() (bool, error) // contains filtered or unexported fields }
func (*Loop) AllowLineWrapping ¶
func (*Loop) ClearPointerShapes ¶
func (self *Loop) ClearPointerShapes() (ans []PointerShape)
Remove all pointer shapes from the shape stack resetting to default pointer shape. This is called automatically on loop termination.
func (*Loop) ClearScreen ¶
func (self *Loop) ClearScreen()
func (*Loop) ClearScreenButNotGraphics ¶
func (self *Loop) ClearScreenButNotGraphics()
func (*Loop) ClearToEndOfLine ¶
func (self *Loop) ClearToEndOfLine()
func (*Loop) ClearToEndOfScreen ¶
func (self *Loop) ClearToEndOfScreen()
func (*Loop) CopyTextToClipboard ¶
func (*Loop) CopyTextToPrimarySelection ¶
func (*Loop) CurrentPointerShape ¶
func (self *Loop) CurrentPointerShape() (ans PointerShape, has_shape bool)
func (*Loop) DeathSignalName ¶
func (*Loop) DebugPrintln ¶
func (*Loop) EndAtomicUpdate ¶
func (self *Loop) EndAtomicUpdate()
func (*Loop) EndBracketedPaste ¶
func (self *Loop) EndBracketedPaste()
func (*Loop) FullKeyboardProtocol ¶
func (*Loop) IsAtomicUpdateActive ¶
func (*Loop) KillIfSignalled ¶
func (self *Loop) KillIfSignalled()
func (*Loop) MouseTrackingMode ¶
func (self *Loop) MouseTrackingMode(mt MouseTracking) *Loop
func (*Loop) MoveCursorHorizontally ¶
func (*Loop) MoveCursorTo ¶
func (*Loop) MoveCursorVertically ¶
func (*Loop) NoAlternateScreen ¶
func (*Loop) NoKeyboardStateChange ¶
func (*Loop) NoMouseTracking ¶
func (*Loop) NoRestoreColors ¶
func (*Loop) OnlyDisambiguateKeys ¶
func (*Loop) PopPointerShape ¶
func (self *Loop) PopPointerShape()
func (*Loop) PrintStyled ¶
func (*Loop) PushPointerShape ¶
func (self *Loop) PushPointerShape(s PointerShape)
func (*Loop) QueryTerminal ¶
func (*Loop) QueueWriteBytesCopy ¶
func (*Loop) QueueWriteString ¶
func (*Loop) RemoveTimer ¶
func (*Loop) RestoreCursorPosition ¶
func (self *Loop) RestoreCursorPosition()
func (*Loop) SaveCursorPosition ¶
func (self *Loop) SaveCursorPosition()
func (*Loop) ScreenSize ¶
func (self *Loop) ScreenSize() (ScreenSize, error)
func (*Loop) SendOverlayReady ¶
func (self *Loop) SendOverlayReady()
func (*Loop) SetCursorShape ¶
func (self *Loop) SetCursorShape(shape CursorShapes, blink bool)
func (*Loop) SetCursorVisible ¶
func (*Loop) SetDefaultColor ¶
func (self *Loop) SetDefaultColor(which DefaultColor, val style.RGBA)
func (*Loop) SetWindowTitle ¶
func (*Loop) StartAtomicUpdate ¶
func (self *Loop) StartAtomicUpdate()
func (*Loop) StartBracketedPaste ¶
func (self *Loop) StartBracketedPaste()
func (*Loop) StyleRectangle ¶
Apply the specified style to the specified rectangle of the screen (0-based indexing).
func (*Loop) StyleRegion ¶
Apply the specified style to the specified region of the screen (0-based indexing). The region is all cells from the start cell to the end cell. See StyleRectangle to apply style to a rectangular area.
func (*Loop) UnsafeQueueWriteBytes ¶
This is dangerous as it is upto the calling code to ensure the data in the underlying array does not change
func (*Loop) WakeupMainThread ¶
type Mode ¶
type Mode uint32
const ( LNM Mode = 20 IRM Mode = 4 DECKM Mode = 1 | private DECSCNM Mode = 5 | private DECOM Mode = 6 | private DECAWM Mode = 7 | private DECARM Mode = 8 | private DECTCEM Mode = 25 | private MOUSE_BUTTON_TRACKING Mode = 1000 | private MOUSE_MOTION_TRACKING Mode = 1002 | private MOUSE_MOVE_TRACKING Mode = 1003 | private FOCUS_TRACKING Mode = 1004 | private MOUSE_UTF8_MODE Mode = 1005 | private MOUSE_SGR_MODE Mode = 1006 | private MOUSE_URXVT_MODE Mode = 1015 | private MOUSE_SGR_PIXEL_MODE Mode = 1016 | private ALTERNATE_SCREEN Mode = 1049 | private BRACKETED_PASTE Mode = 2004 | private PENDING_UPDATE Mode = 2026 | private INBAND_RESIZE_NOTIFICATION Mode = 2048 | private HANDLE_TERMIOS_SIGNALS Mode = kitty.HandleTermiosSignals | private )
func (Mode) EscapeCodeToReset ¶
func (Mode) EscapeCodeToSet ¶
type MouseButtonFlag ¶
type MouseButtonFlag uint
const ( NO_MOUSE_BUTTON MouseButtonFlag = 0 LEFT_MOUSE_BUTTON MouseButtonFlag = 1 << iota MIDDLE_MOUSE_BUTTON RIGHT_MOUSE_BUTTON FOURTH_MOUSE_BUTTON FIFTH_MOUSE_BUTTON SIXTH_MOUSE_BUTTON SEVENTH_MOUSE_BUTTON MOUSE_WHEEL_UP MOUSE_WHEEL_DOWN MOUSE_WHEEL_LEFT MOUSE_WHEEL_RIGHT )
func (MouseButtonFlag) String ¶
func (b MouseButtonFlag) String() string
type MouseEvent ¶
type MouseEvent struct { Event_type MouseEventType Buttons MouseButtonFlag Mods KeyModifiers Cell, Pixel struct{ X, Y int } }
func MouseEventFromCSI ¶
func MouseEventFromCSI(csi string, screen_size ScreenSize) *MouseEvent
func (MouseEvent) String ¶
func (e MouseEvent) String() string
type MouseEventType ¶
type MouseEventType uint
const ( MOUSE_PRESS MouseEventType = iota MOUSE_RELEASE MOUSE_MOVE MOUSE_CLICK )
func (MouseEventType) String ¶
func (e MouseEventType) String() string
type MouseTracking ¶
type MouseTracking uint8
const ( NO_MOUSE_TRACKING MouseTracking = iota BUTTONS_ONLY_MOUSE_TRACKING BUTTONS_AND_DRAG_MOUSE_TRACKING FULL_MOUSE_TRACKING )
type ParsedShortcut ¶
type ParsedShortcut struct { Mods KeyModifiers KeyName string }
func ParseShortcut ¶
func ParseShortcut(spec string) *ParsedShortcut
func (*ParsedShortcut) String ¶
func (self *ParsedShortcut) String() string
type PointerShape ¶
type PointerShape uint8
const ( // start pointer shape enum (auto generated by gen-key-constants.py do not edit) DEFAULT_POINTER PointerShape = 0 TEXT_POINTER PointerShape = 1 POINTER_POINTER PointerShape = 2 HELP_POINTER PointerShape = 3 WAIT_POINTER PointerShape = 4 PROGRESS_POINTER PointerShape = 5 CROSSHAIR_POINTER PointerShape = 6 CELL_POINTER PointerShape = 7 VERTICAL_TEXT_POINTER PointerShape = 8 MOVE_POINTER PointerShape = 9 E_RESIZE_POINTER PointerShape = 10 NE_RESIZE_POINTER PointerShape = 11 NW_RESIZE_POINTER PointerShape = 12 N_RESIZE_POINTER PointerShape = 13 SE_RESIZE_POINTER PointerShape = 14 SW_RESIZE_POINTER PointerShape = 15 S_RESIZE_POINTER PointerShape = 16 W_RESIZE_POINTER PointerShape = 17 EW_RESIZE_POINTER PointerShape = 18 NS_RESIZE_POINTER PointerShape = 19 NESW_RESIZE_POINTER PointerShape = 20 NWSE_RESIZE_POINTER PointerShape = 21 ZOOM_IN_POINTER PointerShape = 22 ZOOM_OUT_POINTER PointerShape = 23 ALIAS_POINTER PointerShape = 24 COPY_POINTER PointerShape = 25 NOT_ALLOWED_POINTER PointerShape = 26 NO_DROP_POINTER PointerShape = 27 GRAB_POINTER PointerShape = 28 GRABBING_POINTER PointerShape = 29 )
func (PointerShape) String ¶
func (e PointerShape) String() string
type ScreenSize ¶
type ScreenSize struct {
WidthCells, HeightCells, WidthPx, HeightPx, CellWidth, CellHeight uint
// contains filtered or unexported fields
}
type TerminalStateOptions ¶
type TerminalStateOptions struct { Alternate_screen bool // contains filtered or unexported fields }
func (*TerminalStateOptions) ResetStateEscapeCodes ¶
func (self *TerminalStateOptions) ResetStateEscapeCodes() string
func (*TerminalStateOptions) SetStateEscapeCodes ¶
func (self *TerminalStateOptions) SetStateEscapeCodes() string
type TimerCallback ¶
Click to show internal directories.
Click to hide internal directories.