tui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const KittyInternalHyperlinkProtocol = "kitty-ih"

Variables

View Source
var Canceled = errors.New("Canceled by user")
View Source
var RunningAsUI = sync.OnceValue(func() bool {
	defer func() { os.Unsetenv("KITTEN_RUNNING_AS_UI") }()
	return os.Getenv("KITTEN_RUNNING_AS_UI") != ""
})
View Source
var TmuxAllowPassthrough = sync.OnceValue(tmux_allow_passthrough)
View Source
var TmuxExe = sync.OnceValue(func() string {
	return utils.FindExe("tmux")
})
View Source
var TmuxSocketAddress = sync.OnceValue(tmux_socket_address)

Functions

func DCSToKitty

func DCSToKitty(msgtype, payload string) (string, error)

func DownloadFileWithProgress

func DownloadFileWithProgress(destpath, url string, kill_if_signaled bool) (err error)

func ExecAndHoldTillEnter

func ExecAndHoldTillEnter(cmdline []string)

func FormatPartOfLine

func FormatPartOfLine(sgr string, start_x, end_x, y int) string

func HoldTillEnter

func HoldTillEnter(start_with_newline bool)
func InternalHyperlink(text, id string) string

func KittenOutputSerializer

func KittenOutputSerializer() func(any) (string, error)

func PrepareRootCmd

func PrepareRootCmd(root *cli.Command)

func ReadPassword

func ReadPassword(prompt string, kill_if_signaled bool) (password string, err error)

func RenderProgressBar

func RenderProgressBar(frac float64, width int) string

func RepeatChar

func RepeatChar(char string, count int) string

func ResolveShell

func ResolveShell(shell string) []string

func ResolveShellIntegration

func ResolveShellIntegration(shell_integration string) string

func RunCommandRestoringTerminalToSaneStateAfter

func RunCommandRestoringTerminalToSaneStateAfter(cmd []string)

func RunShell

func RunShell(shell_cmd []string, shell_integration_env_var_val, cwd string) (err error)

Types

type CellRegion

type CellRegion struct {
	TopLeft, BottomRight struct{ X, Y int }
	Id                   string
	OnClick              []func(id string) error
}

func (CellRegion) Contains

func (c CellRegion) Contains(x, y int) bool

type KilledBySignal

type KilledBySignal struct {
	Msg        string
	SignalName string
}

func (*KilledBySignal) Error

func (self *KilledBySignal) Error() string

type KittyOpts

type KittyOpts struct {
	Shell, Shell_integration string
}

type LinePos

type LinePos interface {
	LessThan(other LinePos) bool
	Equal(other LinePos) bool
	MinX() int
	MaxX() int
}

type MouseSelection

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

func (*MouseSelection) Clear

func (self *MouseSelection) Clear()

func (*MouseSelection) DragScroll

func (ms *MouseSelection) DragScroll(ev *loop.MouseEvent, lp *loop.Loop, callback loop.TimerCallback)

func (*MouseSelection) DragScrollTick

func (ms *MouseSelection) DragScrollTick(timer_id loop.IdType, lp *loop.Loop, callback loop.TimerCallback, do_scroll func(int, *loop.MouseEvent) error) error

func (*MouseSelection) EndLine

func (ms *MouseSelection) EndLine() LinePos

func (*MouseSelection) Finish

func (self *MouseSelection) Finish()

func (*MouseSelection) IsActive

func (self *MouseSelection) IsActive() bool

func (*MouseSelection) IsEmpty

func (self *MouseSelection) IsEmpty() bool

func (*MouseSelection) LineBounds

func (ms *MouseSelection) LineBounds(line_pos LinePos) (start_x, end_x int)

func (*MouseSelection) LineFormatSuffix

func (ms *MouseSelection) LineFormatSuffix(line_pos LinePos, sgr string, y int) string

func (*MouseSelection) OutOfVerticalBounds

func (ms *MouseSelection) OutOfVerticalBounds(ev *loop.MouseEvent) bool

func (*MouseSelection) StartLine

func (ms *MouseSelection) StartLine() LinePos

func (*MouseSelection) StartNewSelection

func (ms *MouseSelection) StartNewSelection(ev *loop.MouseEvent, line LinePos, min_y, max_y, cell_width, cell_height int)

func (*MouseSelection) Update

func (ms *MouseSelection) Update(ev *loop.MouseEvent, line LinePos)

type MouseState

type MouseState struct {
	Cell, Pixel struct{ X, Y int }
	Pressed     struct{ Left, Right, Middle, Fourth, Fifth, Sixth, Seventh bool }
	// contains filtered or unexported fields
}

func (*MouseState) AddCellRegion

func (m *MouseState) AddCellRegion(id string, start_x, start_y, end_x, end_y int, on_click ...func(id string) error) *CellRegion

func (*MouseState) ApplyHoverStyles

func (m *MouseState) ApplyHoverStyles(lp *loop.Loop, style ...string)

func (*MouseState) ClearCellRegions

func (m *MouseState) ClearCellRegions()

func (*MouseState) ClickHoveredRegions

func (m *MouseState) ClickHoveredRegions() error

func (*MouseState) UpdateHoveredIds

func (m *MouseState) UpdateHoveredIds() (changed bool)

func (*MouseState) UpdateState

func (m *MouseState) UpdateState(ev *loop.MouseEvent) (hovered_ids_changed bool)

type RenderLines

type RenderLines struct {
}

func (RenderLines) InRectangle

func (r RenderLines) InRectangle(
	lines []string, start_x, start_y, width, height int, mouse_state *MouseState, on_click ...func(id string) error,
) (all_rendered bool, y_after_last_line int, ans string)

Render lines in the specified rectangle. If width > 0 then lines are wrapped to fit in the width. A string containing rendered lines with escape codes to move cursor is returned. Any internal hyperlinks are added to the MouseState.

type SelectionBoundary

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

func (*SelectionBoundary) Equal

func (self *SelectionBoundary) Equal(other SelectionBoundary) bool

func (*SelectionBoundary) LessThan

func (self *SelectionBoundary) LessThan(other *SelectionBoundary) bool

type Spinner

type Spinner struct {
	Name string
	// contains filtered or unexported fields
}

func (Spinner) Interval

func (self Spinner) Interval() time.Duration

func (*Spinner) Tick

func (self *Spinner) Tick() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳