Model is the Bubble Tea model for this text input element.
Constructors
new
New creates a new model with default settings.
SourceInstance methods
available_suggestions
AvailableSuggestions returns the list of available suggestions.
Sourceblur
Blur removes the focus state on the model. When the model is blurred it can
not receive keyboard input and the cursor will be hidden.
Sourcecopy
copy creates a copy of the model for functional updates.
Sourcecurrent_suggestion
CurrentSuggestion returns the currently selected suggestion.
Sourcecurrent_suggestion_index
CurrentSuggestionIndex returns the currently selected suggestion index.
Sourcecurrent_suggestion_index=(current_suggestion_index :
Int32)
Sourcecursor
Cursor returns a Tea::Cursor for rendering a real cursor in a Bubble Tea
program. This requires that virtual_cursor is set to false.
Note that you will almost certainly also need to adjust the offset cursor
position per the textarea's per the textarea's position in the terminal.
Example:
In your top-level View function:
f = Tea::Frame.new(m.textarea.view)
f.cursor = m.textarea.cursor
f.cursor.position.x += offset_x
f.cursor.position.y += offset_y
Sourcecursor_end
CursorEnd moves the cursor to the end of the input field.
Sourcecursor_start
CursorStart moves the cursor to the start of the input field.
Sourceecho_mode=(echo_mode : EchoMode)
Sourcefocus
Focus sets the focus state on the model. When the model is in focus it can
receive keyboard input and the cursor will be shown.
Sourcefocused?
Focused returns the focus state on the model.
Sourceinit
Init returns the initial command(s) for the model.
Sourcekey_map=(key_map : KeyMap)
Sourcematched_suggestions
MatchedSuggestions returns the list of matched suggestions.
Sourcenext_suggestion
next_suggestion selects the next suggestion.
Made public for test parity with Go (Go test in same package calls it directly).
Sourceposition
Position returns the cursor position.
Sourceprevious_suggestion
previous_suggestion selects the previous suggestion.
Made public for test parity with Go (Go test in same package calls it directly).
Sourcereset
Reset sets the input to its default state with no input.
Sourcersan=(rsan : Sanitizer | Nil)
SourceSetCursor moves the cursor to the given position. If the position is
out of bounds the cursor will be moved to the start or end accordingly.
Sourceset_styles(s : Styles)
SetStyles sets the styles for the text input.
SourceSetSuggestions sets the suggestions for the input.
SourceSetValue sets the value of the text input.
Sourceset_virtual_cursor(v :
Bool)
SetVirtualCursor sets whether the model should use a virtual cursor.
SourceSetWidth sets the width of the text input.
Sourcestyles
Styles returns the current set of styles.
SourceUpdate handles incoming messages and returns an updated model
along with optional commands.
Sourceupdate_suggestions
update_suggestions refreshes the list of matching suggestions.
Made public for test parity with Go (Go test in same package calls it directly).
Sourceuse_virtual_cursor=(use_virtual_cursor :
Bool)
Sourcevalidate=(validate : ValidateFunc | Nil)
Sourcevalue
Value returns the value of the text input.
Sourceview
View renders the model's current state as a string for display.
Sourcevirtual_cursor
VirtualCursor returns whether the model is using a virtual cursor.
Sourcevirtual_cursor=(virtual_cursor : Cursor::Model)
Source