tui

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

internal/tui/drawing.go

internal/tui/tui.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawBox added in v0.1.3

func DrawBox(screen tcell.Screen, x, y, width, height int, style tcell.Style)

DrawBox is a utility to draw a bordered box on the screen

func DrawBuffer

func DrawBuffer(tuiManager *TUI, editor *core.Editor, activeTheme *theme.Theme)

DrawBuffer draws the *visible* portion using the provided theme. It uses the editor's dirty-line tracking to skip rows that have not changed, avoiding redundant screen.SetContent calls. After drawing, it calls ClearDirty.

func DrawCursor

func DrawCursor(tuiManager *TUI, editor *core.Editor)

DrawCursor positions the terminal cursor using visual width calculations.

func DrawText added in v0.1.3

func DrawText(screen tcell.Screen, x, y, maxWidth int, text string, style tcell.Style)

DrawText draws text at a given position, truncated to maxWidth visual columns. Uses uniseg for grapheme-cluster-aware width measurement (consistent with DrawBuffer).

Types

type FuzzyFinder added in v0.1.3

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

FuzzyFinder is an overlay for finding files

func NewFuzzyFinder added in v0.1.3

func NewFuzzyFinder(onSelect func(filePath string)) *FuzzyFinder

NewFuzzyFinder creates a new instance

func (*FuzzyFinder) Draw added in v0.1.3

func (f *FuzzyFinder) Draw(screen tcell.Screen, th *theme.Theme, screenW, screenH int)

func (*FuzzyFinder) HandleKeyEvent added in v0.1.3

func (f *FuzzyFinder) HandleKeyEvent(ev *tcell.EventKey) bool

func (*FuzzyFinder) IsActive added in v0.1.3

func (f *FuzzyFinder) IsActive() bool

func (*FuzzyFinder) Toggle added in v0.1.3

func (f *FuzzyFinder) Toggle(rootPath string)

Toggle activates or deactivates the finder

type Overlay added in v0.1.3

type Overlay interface {
	Draw(screen tcell.Screen, t *theme.Theme, screenW, screenH int)
	HandleKeyEvent(ev *tcell.EventKey) bool // returns true if event was consumed
	IsActive() bool
}

Overlay represents a floating UI element

type TUI

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

TUI manages the terminal screen using tcell.

func New

func New() (*TUI, error)

New creates and initializes a new TUI instance.

func (*TUI) Clear

func (t *TUI) Clear()

Clear clears the entire screen ensuring the background color is applied.

func (*TUI) Close

func (t *TUI) Close()

Close finalizes the tcell screen.

func (*TUI) GetScreen

func (t *TUI) GetScreen() tcell.Screen

GetScreen provides direct access (use with caution).

func (*TUI) PollEvent

func (t *TUI) PollEvent() tcell.Event

PollEvent retrieves the next event.

func (*TUI) Show

func (t *TUI) Show()

Show makes the changes visible.

func (*TUI) Size

func (t *TUI) Size() (int, int)

Size returns the width and height of the terminal screen.

Jump to

Keyboard shortcuts

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