component

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKeyMap = KeyMap{
	AcceptSuggestion: key.NewBinding(key.WithKeys("tab")),
	NextSuggestion:   key.NewBinding(key.WithKeys("down", "ctrl+n")),
	PrevSuggestion:   key.NewBinding(key.WithKeys("up", "ctrl+p")),
}

DefaultKeyMap is the default set of key bindings for navigating and acting upon the textinput.

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	AcceptSuggestion key.Binding
	NextSuggestion   key.Binding
	PrevSuggestion   key.Binding
}

KeyMap is the key bindings for different actions within the textinput.

type Replacer added in v0.6.2

type Replacer interface {
	Replace(channelID, content string, emoteList []twitchirc.Emote) (string, map[string]string, error)
}

type SuggestionTextInput

type SuggestionTextInput struct {
	InputModel textinput.Model

	KeyMap KeyMap

	IncludeCommandSuggestions  bool
	IncludeModeratorCommands   bool
	DisableAutoSpaceSuggestion bool
	DisableHistory             bool
	EmoteReplacer              Replacer

	// Line number styles (only shown when content spans multiple lines)
	LineNumberStyle        lipgloss.Style // style for non-current line numbers
	CurrentLineNumberStyle lipgloss.Style // style for current line number (highlighted)
	// contains filtered or unexported fields
}

func NewSuggestionTextInput

func NewSuggestionTextInput(userCache map[string]func(...string) string, customSuggestions map[string]string) *SuggestionTextInput

NewSuggestionTextInput creates a new model with default settings.

func (*SuggestionTextInput) Blur

func (s *SuggestionTextInput) Blur()

func (*SuggestionTextInput) Focus

func (s *SuggestionTextInput) Focus()

func (*SuggestionTextInput) LineCount added in v0.7.0

func (s *SuggestionTextInput) LineCount() int

LineCount returns the number of visible lines the input will render. Use this instead of calling lipgloss.Height(View()) to avoid double-rendering.

func (*SuggestionTextInput) SetMaxVisibleLines added in v0.7.0

func (s *SuggestionTextInput) SetMaxVisibleLines(n int)

SetMaxVisibleLines sets the maximum number of visible lines for wrapped display. When n > 1, input text will be soft-wrapped and displayed across multiple lines. When n == 1 (default), the original single-line behavior is used.

func (*SuggestionTextInput) SetSuggestions

func (s *SuggestionTextInput) SetSuggestions(suggestions []string)

func (*SuggestionTextInput) SetValue

func (s *SuggestionTextInput) SetValue(val string)

func (*SuggestionTextInput) SetWidth

func (s *SuggestionTextInput) SetWidth(width int)

func (*SuggestionTextInput) Update

func (*SuggestionTextInput) Value

func (s *SuggestionTextInput) Value() string

func (*SuggestionTextInput) View

func (s *SuggestionTextInput) View() string

Jump to

Keyboard shortcuts

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