input

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: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input[T any] interface {
	OnUpdateStart(msg tea.Msg) tea.Cmd
	View(viewMode ViewMode) string
	Focus() tea.Cmd
	Focused() bool
	Value() string
	Runes() []rune
	ResetValue()
	SetValue(value string)
	Blur()
	CursorIndex() int
	CursorOffset() int
	SetCursor(cursor int)
	SetCursorMode(cursorMode cursor.Mode) tea.Cmd
	Prompt() string
	SetPrompt(prompt string)
	Tokens() []Token
	CurrentToken() Token
	CurrentTokenRoundDown() Token
	ShouldSelectSuggestion(suggestion suggestion.Suggestion[T]) bool
	SuggestionRunes(runes []rune) []rune
	OnUpdateFinish(msg tea.Msg, suggestion *suggestion.Suggestion[T], isSelected bool) tea.Cmd
	OnSuggestionChanged(suggestion suggestion.Suggestion[T])
	OnExecutorFinished()
	OnSuggestionUnselected()
	ShouldClearSuggestions(prevRunes []rune, msg tea.KeyMsg) bool
	ShouldUnselectSuggestion(prevRunes []rune, msg tea.KeyMsg) bool
}

type RoundingBehavior

type RoundingBehavior int
const (
	RoundUp RoundingBehavior = iota
	RoundDown
)

type Token

type Token struct {
	Start int
	Type  string
	Value string
	Index int
}

func FindCurrentToken

func FindCurrentToken(
	runes []rune,
	tokens []Token,
	cursor int,
	roundingBehavior RoundingBehavior,
	isDelimiter func(s string, last Token) bool,
) Token

func TokenFromPos

func TokenFromPos(value string, tokenType string, index int, pos lexer.Position) Token

func (Token) End

func (t Token) End() int

func (Token) Unescape

func (t Token) Unescape(wrapper string) string

func (Token) Unquote

func (t Token) Unquote() string

type ViewBuilder

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

func NewViewBuilder

func NewViewBuilder(
	cursor int,
	cursorStyle lipgloss.Style,
	delimiter string,
	showCursor bool,
) *ViewBuilder

func (ViewBuilder) Last

func (v ViewBuilder) Last() *byte

func (*ViewBuilder) Render

func (v *ViewBuilder) Render(newRunes []rune, column int, style lipgloss.Style)

func (*ViewBuilder) RenderPlaceholder

func (v *ViewBuilder) RenderPlaceholder(newRunes []rune, offset int, style lipgloss.Style)

func (ViewBuilder) View

func (v ViewBuilder) View() string

func (*ViewBuilder) ViewLen

func (v *ViewBuilder) ViewLen() int

type ViewMode

type ViewMode int
const (
	Interactive ViewMode = iota
	Static
)

Directories

Path Synopsis
Package commandinput provides an implementation of the [input.Input] interface.
Package commandinput provides an implementation of the [input.Input] interface.
Package simpleinput provides an implementation of the [input.Input] interface.
Package simpleinput provides an implementation of the [input.Input] interface.

Jump to

Keyboard shortcuts

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