API
input
import "github.com/aschey/bubbleprompt/input"
Index
- type Input
- type RoundingBehavior
- type Token
- func FindCurrentToken(runes []rune, tokens []Token, cursor int, roundingBehavior RoundingBehavior, isDelimiter func(s string, last Token) bool) Token
- func TokenFromPos(value string, tokenType string, index int, pos lexer.Position) Token
- func (t Token) End() int
- func (t Token) Unescape(wrapper string) string
- func (t Token) Unquote() string
- type ViewBuilder
- func NewViewBuilder(cursor int, cursorStyle lipgloss.Style, delimiter string, showCursor bool) *ViewBuilder
- func (v ViewBuilder) Last() *byte
- func (v *ViewBuilder) Render(newRunes []rune, column int, style lipgloss.Style)
- func (v *ViewBuilder) RenderPlaceholder(newRunes []rune, offset int, style lipgloss.Style)
- func (v ViewBuilder) View() string
- func (v *ViewBuilder) ViewLen() int
- type ViewMode
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
)
Generated by gomarkdoc