component

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandSuggestions = [...]string{
	"/inspect <username>",
	"/popupchat",
	"/channel",
	"/pyramid <word> <count>",
	"/localsubscribers",
	"/localsubscribersoff",
	"/uniqueonly",
	"/uniqueonlysoff",
	"/createclip",
	"/emotes",
}
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.

View Source
var ModeratorSuggestions = [...]string{
	"/ban <user> [reason]",
	`/ban_selected {{ if .SelectedDisplayName }}{{ .SelectedDisplayName }}{{ else }}<user>{{ end }} [reason]`,

	"/unban <user>",
	`/unban_selected {{ if .SelectedDisplayName }}{{ .SelectedDisplayName }}{{ else }}<user>{{ end }}`,

	"/timeout <username> [duration] [reason]",
	`/timeout_selected {{ if .SelectedDisplayName }}{{ .SelectedDisplayName }}{{ else }}<user>{{ end }} [duration] [reason]`,

	"/delete_all_messages",
	`/delete_selected_message {{ if .MessageID }}{{ .MessageID }}{{ else }}<message_id>{{ end }}`,

	"/banrequests",
	"/announcement <blue|green|orange|purple|primary> <message>",
	"/announcement blue <message>",
	"/announcement green <message>",
	"/announcement orange <message>",
	"/announcement purple <message>",
	"/announcement primary <message>",

	"/marker [description]",
}

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 SuggestionTextInput

type SuggestionTextInput struct {
	InputModel textinput.Model

	KeyMap KeyMap

	IncludeCommandSuggestions  bool
	IncludeModeratorCommands   bool
	DisableAutoSpaceSuggestion bool
	DisableHistory             bool
	// 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) 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