renderer

package
v0.0.0-...-ea2a2fb Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNewlineIfMissing

func AddNewlineIfMissing(s string) string

func CountNewlines

func CountNewlines(s string) int

func PlaceOverlay

func PlaceOverlay(x int, y int, fg string, bg string, opts ...WhitespaceOption) string

func TrimNewline

func TrimNewline(s string) string

func Unescape

func Unescape(s string, wrapper string) string

Types

type Option

type Option func(settings *rendererSettings)

func WithHeightOffset

func WithHeightOffset(offset int) Option

func WithUseHistory

func WithUseHistory(useHistory bool) Option

func WithWidthOffset

func WithWidthOffset(offset int) Option

type Renderer

type Renderer interface {
	View() string
	Initialize(msg tea.WindowSizeMsg)
	SetSize(msg tea.WindowSizeMsg)
	Update(msg tea.Msg) (Renderer, tea.Cmd)
	FinishUpdate() tea.Cmd
	SetInput(input string)
	SetBody(suggestions string)
	AddHistory(output string)
	GotoBottom(msg tea.Msg)
	GetHistory() string
	SetHistory(history string) tea.Cmd
}

type UnmanagedRenderer

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

func NewUnmanagedRenderer

func NewUnmanagedRenderer(options ...Option) *UnmanagedRenderer

func (*UnmanagedRenderer) AddHistory

func (u *UnmanagedRenderer) AddHistory(output string)

func (*UnmanagedRenderer) Body

func (u *UnmanagedRenderer) Body() string

func (*UnmanagedRenderer) FinishUpdate

func (u *UnmanagedRenderer) FinishUpdate() tea.Cmd

func (*UnmanagedRenderer) GetHistory

func (u *UnmanagedRenderer) GetHistory() string

func (*UnmanagedRenderer) GotoBottom

func (u *UnmanagedRenderer) GotoBottom(msg tea.Msg)

func (*UnmanagedRenderer) Initialize

func (u *UnmanagedRenderer) Initialize(msg tea.WindowSizeMsg)

func (*UnmanagedRenderer) Input

func (u *UnmanagedRenderer) Input() string

func (*UnmanagedRenderer) SetBody

func (u *UnmanagedRenderer) SetBody(body string)

func (*UnmanagedRenderer) SetHistory

func (u *UnmanagedRenderer) SetHistory(history string) tea.Cmd

func (*UnmanagedRenderer) SetInput

func (u *UnmanagedRenderer) SetInput(input string)

func (*UnmanagedRenderer) SetSize

func (u *UnmanagedRenderer) SetSize(msg tea.WindowSizeMsg)

func (*UnmanagedRenderer) Update

func (u *UnmanagedRenderer) Update(msg tea.Msg) (Renderer, tea.Cmd)

func (*UnmanagedRenderer) View

func (u *UnmanagedRenderer) View() string

type ViewportRenderer

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

func NewViewportRenderer

func NewViewportRenderer(options ...Option) *ViewportRenderer

func (*ViewportRenderer) AddHistory

func (v *ViewportRenderer) AddHistory(output string)

func (*ViewportRenderer) FinishUpdate

func (v *ViewportRenderer) FinishUpdate() tea.Cmd

func (*ViewportRenderer) GetHistory

func (v *ViewportRenderer) GetHistory() string

func (*ViewportRenderer) GotoBottom

func (v *ViewportRenderer) GotoBottom(msg tea.Msg)

func (*ViewportRenderer) Initialize

func (v *ViewportRenderer) Initialize(msg tea.WindowSizeMsg)

func (*ViewportRenderer) SetBody

func (v *ViewportRenderer) SetBody(body string)

func (*ViewportRenderer) SetHistory

func (v *ViewportRenderer) SetHistory(history string) tea.Cmd

func (*ViewportRenderer) SetInput

func (v *ViewportRenderer) SetInput(input string)

func (*ViewportRenderer) SetSize

func (v *ViewportRenderer) SetSize(msg tea.WindowSizeMsg)

func (*ViewportRenderer) Update

func (v *ViewportRenderer) Update(msg tea.Msg) (Renderer, tea.Cmd)

func (*ViewportRenderer) View

func (v *ViewportRenderer) View() string

type WhitespaceOption

type WhitespaceOption func(*whitespace)

WhitespaceOption sets a styling rule for rendering whitespace.

Jump to

Keyboard shortcuts

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