Skip to main content

API

lexerinput

import "github.com/aschey/bubbleprompt/input/lexerinput"

Index

Variables

var DefaultCurrentPlaceholderSuggestion = "240"

type Formatters

Formatters handles styling for the input.

type Formatters struct {
// Placeholder handles styling for placeholder that's shown as the user types the current argument.
Placeholder lipgloss.Style

// Cursor handles styling for the cursor.
Cursor lipgloss.Style
}

func DefaultFormatters

func DefaultFormatters() Formatters

DefaultFormatters initializes the Formatters with sensible defaults. You can modify any settings that you wish after calling this function.

type Model

type Model[T any] struct {
// contains filtered or unexported fields
}

func NewModel

func NewModel[T any](lexer parser.Lexer, options ...Option[T]) *Model[T]

func (*Model[T]) Blur

func (m *Model[T]) Blur()

func (Model[T]) CompletableTokenBeforeCursor

func (m Model[T]) CompletableTokenBeforeCursor() string

func (Model[T]) CurrentToken

func (m Model[T]) CurrentToken() input.Token

func (Model[T]) CurrentTokenBeforeCursor

func (m Model[T]) CurrentTokenBeforeCursor() string

func (Model[T]) CurrentTokenRoundDown

func (m Model[T]) CurrentTokenRoundDown() input.Token

func (Model[T]) CursorIndex

func (m Model[T]) CursorIndex() int

func (Model[T]) CursorOffset

func (m Model[T]) CursorOffset() int

func (Model[T]) Error

func (m Model[T]) Error() error

func (Model[T]) FindLast

func (m Model[T]) FindLast(filter func(token input.Token, symbol string) bool) *input.Token

func (*Model[T]) Focus

func (m *Model[T]) Focus() tea.Cmd

func (Model[T]) Focused

func (m Model[T]) Focused() bool

func (Model[T]) FormatText

func (m Model[T]) FormatText(text string) string

func (Model[T]) Formatters

func (m Model[T]) Formatters() Formatters

Formatters returns the formatters used by the input.

func (Model[T]) IsDelimiterToken

func (m Model[T]) IsDelimiterToken(token input.Token) bool

func (*Model[T]) OnExecutorFinished

func (m *Model[T]) OnExecutorFinished()

func (*Model[T]) OnSuggestionChanged

func (m *Model[T]) OnSuggestionChanged(suggestion suggestion.Suggestion[T])

func (*Model[T]) OnSuggestionUnselected

func (m *Model[T]) OnSuggestionUnselected()

func (*Model[T]) OnUpdateFinish

func (m *Model[T]) OnUpdateFinish(msg tea.Msg, suggestion *suggestion.Suggestion[T], isSelected bool) tea.Cmd

func (*Model[T]) OnUpdateStart

func (m *Model[T]) OnUpdateStart(msg tea.Msg) tea.Cmd

func (Model[T]) PreviousToken

func (m Model[T]) PreviousToken() *input.Token

func (Model[T]) Prompt

func (m Model[T]) Prompt() string

func (*Model[T]) ResetValue

func (m *Model[T]) ResetValue()

func (Model[T]) Runes

func (m Model[T]) Runes() []rune

func (*Model[T]) SetCursor

func (m *Model[T]) SetCursor(cursor int)

func (*Model[T]) SetCursorMode

func (m *Model[T]) SetCursorMode(cursorMode cursor.Mode) tea.Cmd

func (*Model[T]) SetFormatters

func (m *Model[T]) SetFormatters(formatters Formatters)

func (*Model[T]) SetPrompt

func (m *Model[T]) SetPrompt(prompt string)

func (*Model[T]) SetValue

func (m *Model[T]) SetValue(value string)

func (Model[T]) ShouldClearSuggestions

func (m Model[T]) ShouldClearSuggestions(prevText []rune, msg tea.KeyMsg) bool

func (Model[T]) ShouldSelectSuggestion

func (m Model[T]) ShouldSelectSuggestion(suggestion suggestion.Suggestion[T]) bool

func (Model[T]) ShouldUnselectSuggestion

func (m Model[T]) ShouldUnselectSuggestion(prevText []rune, msg tea.KeyMsg) bool

func (Model[T]) SuggestionRunes

func (m Model[T]) SuggestionRunes(runes []rune) []rune

func (Model[T]) TokenValues

func (m Model[T]) TokenValues() []string

func (Model[T]) Tokens

func (m Model[T]) Tokens() []input.Token

func (Model[T]) TokensBeforeCursor

func (m Model[T]) TokensBeforeCursor() []input.Token

func (Model[T]) Value

func (m Model[T]) Value() string

func (Model[T]) View

func (m Model[T]) View(viewMode input.ViewMode) string

type Option

type Option[T any] func(model *Model[T])

func WithCursorMode

func WithCursorMode[T any](cursorMode cursor.Mode) Option[T]

func WithDelimiterTokens

func WithDelimiterTokens[T any](tokens ...string) Option[T]

func WithDelimiters

func WithDelimiters[T any](delimiters ...string) Option[T]

func WithFormatters

func WithFormatters[T any](formatters Formatters) Option[T]

func WithPrompt

func WithPrompt[T any](prompt string) Option[T]

func WithTokenFormatter

func WithTokenFormatter[T any](formatter parser.Formatter) Option[T]

Generated by gomarkdoc