types

package
v0.0.0-...-0b28cfc Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NOTIFY_DEBUG = iota
	NOTIFY_INFO
	NOTIFY_WARN
	NOTIFY_ERROR
	NOTIFY_SCROLL
)

Variables

View Source
var (
	// solarized dark
	SGR_COLOUR_BLACK   = &Colour{7, 54, 66}
	SGR_COLOUR_RED     = &Colour{220, 50, 47}
	SGR_COLOUR_GREEN   = &Colour{133, 153, 0}
	SGR_COLOUR_YELLOW  = &Colour{181, 137, 0}
	SGR_COLOUR_BLUE    = &Colour{38, 139, 210}
	SGR_COLOUR_MAGENTA = &Colour{211, 54, 130}
	SGR_COLOUR_CYAN    = &Colour{42, 161, 152}
	SGR_COLOUR_WHITE   = &Colour{238, 232, 213}

	SGR_COLOUR_BLACK_BRIGHT   = &Colour{0, 43, 54}
	SGR_COLOUR_RED_BRIGHT     = &Colour{203, 75, 22}
	SGR_COLOUR_GREEN_BRIGHT   = &Colour{88, 110, 117}
	SGR_COLOUR_YELLOW_BRIGHT  = &Colour{101, 123, 131}
	SGR_COLOUR_BLUE_BRIGHT    = &Colour{131, 148, 150}
	SGR_COLOUR_MAGENTA_BRIGHT = &Colour{108, 113, 196}
	SGR_COLOUR_CYAN_BRIGHT    = &Colour{147, 161, 161}
	SGR_COLOUR_WHITE_BRIGHT   = &Colour{253, 246, 227}
)
View Source
var BlinkColour = map[bool]*Colour{
	// contains filtered or unexported fields
}
View Source
var SGR_COLOUR_256 = map[int32]*Colour{}/* 256 elements not displayed */

SGR_COLOUR_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_COLOUR_WHITE,
	Bg: SGR_COLOUR_BLACK,
}

Functions

This section is empty.

Types

type ApcSlice

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

func NewApcSlice

func NewApcSlice(apc []rune) *ApcSlice

func (*ApcSlice) Index

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

func (*ApcSlice) Parameters

func (as *ApcSlice) Parameters(params any)

type Cell

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

func (*Cell) Clear

func (c *Cell) Clear()

type Colour

type Colour struct {
	Red   byte
	Green byte
	Blue  byte
}

func (*Colour) Copy

func (c *Colour) Copy() *Colour

type Element

type Element interface {
	Begin(*ApcSlice)
	ReadCell(*Cell)
	End() *XY             // return is optional
	Insert(*ApcSlice) *XY // return is required
	Draw(*Rect) *XY       // return is optional
	MouseClick(uint8, *XY)
	Close()
}

type ElementID

type ElementID int
const (
	ELEMENT_ID_IMAGE ElementID = iota
	ELEMENT_ID_TABLE
	ELEMENT_ID_FOLDABLE
)

type Image

type Image interface {
	Size() *XY
	Asset() any
	Draw(size *XY, rect *Rect)
	Close()
}

type Notification

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

type NotificationType

type NotificationType int

type Pty

type Pty interface {
	File() *os.File
	Read() rune
	Write([]byte) error
}

type Rect

type Rect struct {
	Start *XY
	End   *XY
}

type Renderer

type Renderer interface {
	Start(Term)
	FocusWindow()
	TermSize() *XY
	PrintCell(*Cell, *XY) error
	GetWindowTitle() string
	SetWindowTitle(string)
	Bell()
	TriggerRedraw()
	NewElement(elementType ElementID, size *XY, data []byte) Element
	DisplayNotification(NotificationType, string)
	DisplaySticky(NotificationType, string) Notification
	DisplayInputBox(string, string, func(string))
	AddRenderFnToStack(func())
	GetWindowMeta() any
	ResizeWindow(*XY)
	Close()
}

type Sgr

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

func (*Sgr) Copy

func (s *Sgr) Copy() *Sgr

func (*Sgr) Reset

func (s *Sgr) Reset()

type SgrFlag

type SgrFlag uint32
const (
	SGR_NORMAL SgrFlag = 0

	SGR_BOLD SgrFlag = 1 << iota
	SGR_ITALIC
	SGR_UNDERLINE
	SGR_STRIKETHROUGH
	SGR_SLOW_BLINK
	SGR_INVERT
)

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 Term

type Term interface {
	Start(Pty, string)
	GetSize() *XY
	Resize(*XY)
	Render()
	Bg() *Colour
	Reply([]byte) error
	MouseClick(uint8, *XY)
	MouseWheel(int)
	ShowCursor(bool)
}

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