types

package
v0.0.0-...-e4882c5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KEY_STR_CTRL  = "Ctrl"
	KEY_STR_SHIFT = "Shift"
)
View Source
const (
	KEY_STR_ALT  = "Alt"
	KEY_STR_META = "Meta"
)
View Source
const (
	NOTIFY_DEBUG = iota
	NOTIFY_INFO
	NOTIFY_WARN
	NOTIFY_ERROR
	NOTIFY_SCROLL
	NOTIFY_QUESTION
)
View Source
const MENU_SEPARATOR = "-"

Variables

View Source
var (
	SGR_COLOR_FOREGROUND = rgb(238, 232, 213)
	SGR_COLOR_BACKGROUND = rgb(0, 43, 54)

	// solarized dark
	SGR_COLOR_BLACK   = rgb(0, 43, 54) // rgb(7, 54, 66)
	SGR_COLOR_RED     = rgb(220, 50, 47)
	SGR_COLOR_GREEN   = rgb(133, 153, 0)
	SGR_COLOR_YELLOW  = rgb(181, 137, 0)
	SGR_COLOR_BLUE    = rgb(38, 139, 210)
	SGR_COLOR_MAGENTA = rgb(211, 54, 130)
	SGR_COLOR_CYAN    = rgb(42, 161, 152)
	SGR_COLOR_WHITE   = rgb(238, 232, 213)

	SGR_COLOR_BLACK_BRIGHT   = rgb(0, 33, 44) // rgb(0, 43, 54)
	SGR_COLOR_RED_BRIGHT     = rgb(203, 75, 22)
	SGR_COLOR_GREEN_BRIGHT   = rgb(88, 110, 117)
	SGR_COLOR_YELLOW_BRIGHT  = rgb(101, 123, 131)
	SGR_COLOR_BLUE_BRIGHT    = rgb(131, 148, 150)
	SGR_COLOR_MAGENTA_BRIGHT = rgb(108, 113, 196)
	SGR_COLOR_CYAN_BRIGHT    = rgb(147, 161, 161)
	SGR_COLOR_WHITE_BRIGHT   = rgb(253, 246, 227)
)
View Source
var (
	COLOR_TEXT_SHADOW   = rgb(0, 0, 0)
	COLOR_SELECTION     = rgb(64, 64, 255)
	COLOR_SEARCH_RESULT = rgb(64, 64, 255)
)
View Source
var (
	COLOR_OK     = SGR_COLOR_GREEN
	COLOR_ERROR  = SGR_COLOR_RED
	COLOR_AI     = SGR_COLOR_BLUE
	COLOR_FOLDED = SGR_COLOR_YELLOW
)
View Source
var (
	ERR_PHRASE_OVERFLOW_ROW = errors.New("overflow row")
	ERR_PHRASE_INVALID_ROW  = errors.New("index does not exist in slice")
)
View Source
var SGR_COLOR_256 = map[int32]*Colour{}/* 256 elements not displayed */

SGR_COLOR_256 colours are a copy of xterm 256 colour values. source: https://vim.fandom.com/wiki/Xterm256_color_names_for_console_Vim

View Source
var SGR_DEFAULT = &Sgr{
	Fg: SGR_COLOR_FOREGROUND,
	Bg: SGR_COLOR_BACKGROUND,
}
View Source
var SGR_HEADING = &Sgr{
	Fg:      SGR_DEFAULT.Fg,
	Bg:      SGR_DEFAULT.Bg,
	Bitwise: SGR_BOLD,
}
View Source
var THEME_LIGHT bool

Functions

func SetElementXY

func SetElementXY(xy *XY) rune

Types

type AiMetaT

type AiMetaT struct {
	Agent    string
	Prompt   *string
	Response *string
}

type ApcSlice

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

func NewApcSlice

func NewApcSlice(apc []rune) *ApcSlice

func NewApcSliceNoParse

func NewApcSliceNoParse(s []string) *ApcSlice

func (*ApcSlice) Index

func (as *ApcSlice) Index(i int) string

func (*ApcSlice) Parameters

func (as *ApcSlice) Parameters(params any) error

type AppWindowTerms

type AppWindowTerms struct {
	Tabs   []Tab
	Tiles  []Tile
	Active Tile
}

type BlockMeta

type BlockMeta struct {
	Id        int64
	Query     []rune // typically command line
	AiMeta    *AiMetaT
	ExitNum   int
	TimeStart time.Time
	TimeEnd   time.Time
	Meta      BlockMetaFlag
}

type BlockMetaFlag

type BlockMetaFlag uint16
const (
	META_BLOCK_NONE BlockMetaFlag = 0
	META_BLOCK_OK   BlockMetaFlag = 1 << iota
	META_BLOCK_ERROR
	META_BLOCK_AI
)

func (BlockMetaFlag) Is

func (f BlockMetaFlag) Is(flag BlockMetaFlag) bool

func (*BlockMetaFlag) Set

func (f *BlockMetaFlag) Set(flag BlockMetaFlag)

func (*BlockMetaFlag) Unset

func (f *BlockMetaFlag) Unset(flag BlockMetaFlag)

type ButtonStateT

type ButtonStateT int
const (
	BUTTON_PRESSED  ButtonStateT = 1
	BUTTON_RELEASED ButtonStateT = 0
)

type CallerT

type CallerT int
const (
	CALLER_updateWinInfo CallerT = 1 + iota
	CALLER__respWindowAdd
)

type Cell

type Cell struct {
	Char    rune
	Sgr     *Sgr
	Element Element
}

func (*Cell) Clear

func (c *Cell) Clear()

func (*Cell) GetElementXY

func (c *Cell) GetElementXY() *XY

func (*Cell) Rune

func (c *Cell) Rune() rune

type Colour

type Colour struct {
	Red   byte
	Green byte
	Blue  byte
	Alpha byte
}

func (*Colour) RGB24

func (c *Colour) RGB24() uint32

RGB32 combines RGB values into a 32-bit integer

func (*Colour) RGBA

func (c *Colour) RGBA() (uint32, uint32, uint32, uint32)

RGBA compatibility with color.Color

func (*Colour) RGBA32

func (c *Colour) RGBA32() uint32

RGBA32 combines RGBA values into a 32-bit integer

type ContextMenu

type ContextMenu interface {
	Append(...MenuItem)
	DisplayMenu(title string, showNextToMouseCursor ...bool)
	Options() []string
	Icons() []rune
	Highlight(int)
	Callback(int)
	Cancel(int)
	MenuItems() []MenuItem
}

type Element

type Element interface {
	Generate(*ApcSlice) error
	Write(rune) error
	Rune(*XY) rune
	Size() *XY
	Draw(*XY)
	MouseClick(*XY, MouseButtonT, uint8, ButtonStateT, EventIgnoredCallback)
	MouseWheel(*XY, *XY, EventIgnoredCallback)
	MouseMotion(*XY, *XY, EventIgnoredCallback)
	MouseHover(curPosTile *XY, curPosElement *XY) func()
	MouseOut()
}

type ElementID

type ElementID int
const (
	ELEMENT_ID_IMAGE ElementID = iota
	ELEMENT_ID_SIXEL
	ELEMENT_ID_CSV
	ELEMENT_ID_MARKDOWN_TABLE
	ELEMENT_ID_HYPERLINK
	ELEMENT_ID_CODEBLOCK
)

type EventIgnoredCallback

type EventIgnoredCallback func()

type FuncMutex

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

func (*FuncMutex) Call

func (fm *FuncMutex) Call() bool

func (*FuncMutex) Set

func (fm *FuncMutex) Set(fn func())

type Image

type Image interface {
	Size() *XY
	Asset() any
	Draw(tile Tile, size *XY, pos *XY)
	Close()
}

type InputBoxCallbackT

type InputBoxCallbackT func(string)

type KeyboardMode

type KeyboardMode int32
const (
	KeysNormal KeyboardMode = 0 + iota
	KeysApplication
	KeysVT220
	KeysVT52
	KeysTmuxClient
)
type MenuCallbackT func(int)
type MenuItem struct {
	Title     string
	Fn        func()
	Highlight func() func()
	Icon      rune
	// WebkitContextHighlightPersistent is set by the webkit renderer for
	// AddToContextMenu() items so Highlight()'s returned function is treated as a
	// per-frame draw callback while the item is highlighted.
	WebkitContextHighlightPersistent bool
}

type MouseButtonT

type MouseButtonT int
const (
	MOUSE_BUTTON_LEFT MouseButtonT = 1 + iota
	MOUSE_BUTTON_MIDDLE
	MOUSE_BUTTON_RIGHT
	MOUSE_BUTTON_X1
	MOUSE_BUTTON_X2
)

type Notification

type Notification interface {
	SetMessage(string)
	UpdateCanceller(func())
	Close()
}

type NotificationType

type NotificationType int

type Pty

type Pty interface {
	ExecuteShell(exit func())
	Read() (rune, error)
	Write([]byte) error
	Resize(*XY) error
	BufSize() int
	Close()
}

type Renderer

type Renderer interface {
	Start(*AppWindowTerms, any, context.Context)
	ShowAndFocusWindow()
	GetWindowSizeCells() *XY
	GetGlyphSize() *XY
	GetBlinkState() bool
	SetBlinkState(bool)
	PrintCell(Tile, *Cell, *XY)
	PrintRow(Tile, []*Cell, *XY)
	DrawFrame(tile Tile)
	DrawGaugeH(tile Tile, topLeft *XY, width int32, value, max int, c *Colour)
	DrawGaugeV(tile Tile, topLeft *XY, height int32, value, max int, c *Colour)
	DrawTable(Tile, *XY, int32, []int32)
	DrawHighlightRect(Tile, *XY, *XY)
	DrawRectWithColour(Tile, *XY, *XY, *Colour, bool)
	DrawRectWithColourAndBorder(Tile, *XY, *XY, *Colour, bool, bool)
	DrawOutputBlockChrome(Tile, int32, int32, *Colour, bool)
	GetWindowTitle() string
	SetWindowTitle(string)
	StatusBarText(string)
	RefreshWindowList()
	Bell()
	TriggerRedraw()
	TriggerLazyRedraw()
	TriggerDeallocation(func())
	TriggerQuit()
	NewElement(Tile, ElementID) Element
	DisplayNotification(NotificationType, string)
	DisplaySticky(NotificationType, string, func()) Notification
	DisplayInputBox(string, string, InputBoxCallbackT, InputBoxCallbackT)
	DisplayMenu(title string, items []string, highlight MenuCallbackT, ok MenuCallbackT, cancel MenuCallbackT)
	NewContextMenu() ContextMenu
	AddToContextMenu(...MenuItem)
	GetWindowMeta() any
	ResizeWindow(*XY)
	SetKeyboardFnMode(KeyboardMode)
	GetKeyboardModifier() int
	RefreshNotes()
	NotesCreateAndOpen(filename, contents string)
	EmitAIResponseChunk(chunk string)
	DisplayImageFullscreen(dataURL string, sourceWidth, sourceHeight int32)
	ActiveTile() Tile
	GetContext() context.Context
	Close()
}

type Row

type Row struct {
	Id      uint64
	Cells   []*Cell
	Hidden  Screen
	Source  *RowSource
	Block   *BlockMeta
	RowMeta RowMetaFlag
}

func (*Row) String

func (r *Row) String() string

type RowMetaFlag

type RowMetaFlag uint16
const (
	META_ROW_NONE        RowMetaFlag = 0
	META_ROW_BEGIN_BLOCK RowMetaFlag = 1 << iota
	META_ROW_END_BLOCK
	META_ROW_FROM_LINE_OVERFLOW
	META_ROW_AUTO_HYPERLINKED
)

func (RowMetaFlag) Is

func (f RowMetaFlag) Is(flag RowMetaFlag) bool

func (*RowMetaFlag) Set

func (f *RowMetaFlag) Set(flag RowMetaFlag)

func (*RowMetaFlag) Unset

func (f *RowMetaFlag) Unset(flag RowMetaFlag)

type RowSource

type RowSource struct {
	Host string
	Pwd  string
}

type Screen

type Screen []*Row

func (*Screen) ContinuousRows

func (screen *Screen) ContinuousRows(rowIndex int) []*Row

func (*Screen) Phrase

func (screen *Screen) Phrase(row int) (string, error)

func (*Screen) PhraseAll

func (screen *Screen) PhraseAll() string

func (*Screen) String

func (screen *Screen) String() string

type SearchMode

type SearchMode int
const (
	SEARCH_REGEX SearchMode = iota
	SEARCH_RESULTS
	SEARCH_CLEAR
	SEARCH_CMD_LINES
	SEARCH_AI_PROMPTS
)

type Sgr

type Sgr struct {
	Bitwise SgrFlag
	Fg      *Colour
	Bg      *Colour
}

func (*Sgr) Copy

func (s *Sgr) Copy() *Sgr

func (*Sgr) HashValue

func (s *Sgr) HashValue() uint64

func (*Sgr) Reset

func (s *Sgr) Reset()

type SgrFlag

type SgrFlag uint16
const (
	SGR_NORMAL SgrFlag = 0
	SGR_BOLD   SgrFlag = 1 << iota
	SGR_ITALIC
	SGR_UNDERLINE
	SGR_STRIKETHROUGH
	SGR_SLOW_BLINK
	SGR_INVERT
	SGR_FAINT
	SGR_INVISIBLE

	SGR_HIGHLIGHT_SEARCH_RESULT
	SGR_HIGHLIGHT_HEADING

	SGR_WIDE_CHAR
	SGR_SPECIAL_FONT_AWESOME
)

Flags

func (SgrFlag) Is

func (f SgrFlag) Is(flag SgrFlag) bool

func (*SgrFlag) Set

func (f *SgrFlag) Set(flag SgrFlag)

func (*SgrFlag) Unset

func (f *SgrFlag) Unset(flag SgrFlag)

type Tab

type Tab interface {
	Name() string
	Rename(string) error
	Id() string
	Index() int
	Active() bool
}

type Term

type Term interface {
	Start(Pty)
	GetSize() *XY
	GetSgr() *Sgr
	GetCellSgr(*XY) *Sgr
	Resize(*XY)
	Render() bool
	Tile() Tile
	GetCursorPosition() *XY
	CopyRange(*XY, *XY) []byte
	CopyLines(int32, int32) []byte
	CopySquare(*XY, *XY) []byte
	Reply([]byte)
	MouseClick(*XY, MouseButtonT, uint8, ButtonStateT, EventIgnoredCallback)
	MouseWheel(*XY, *XY)
	MouseMotion(*XY, *XY, EventIgnoredCallback)
	IsMouseCaptureEnabled() bool
	MouseHover(*XY)
	ShowCursor(bool)
	SetFocus(bool)
	IsFocused() bool
	MakeVisible(bool)
	Search(SearchMode)
	Match(*XY)
	GetRowId(int32) uint64
	InsertSubTerm(string, string, uint64, BlockMetaFlag, *AiMetaT, time.Time) error
	ConvertRelativeToAbsoluteY(*XY) int32
	FoldAtIndent(*XY) error
	GetTermContents() []byte
	Host(*XY) string
	Pwd(*XY) string
	CmdLine(*XY) string
	Close()
}

type TerminalPaneTab

type TerminalPaneTab struct {
	ID     string
	Name   string
	Active bool
}

TerminalPaneTab represents a non-tmux tab rendered in the terminal pane UI (for example, embedded Notes when the notes pane is collapsed).

type Tile

type Tile interface {
	Name() string
	SetName(string)
	GroupName() string
	Id() string
	Left() int32
	Top() int32
	Right() int32
	Bottom() int32
	AtBottom() bool
	GetTerm() Term
	SetTerm(Term)
	Pwd() string
	Close()
}

type XY

type XY struct {
	X int32
	Y int32
}

Jump to

Keyboard shortcuts

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