textinput

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Padding = 1 // how much left and right padding to add

Variables

This section is empty.

Functions

This section is empty.

Types

type TextInputModel

type TextInputModel struct {
	// contains filtered or unexported fields
}

TextInputModel is the TextInputModel for a textinput. The textinput allows users to enter and modify text.

func InitialModel

func InitialModel(name string, prompt string) TextInputModel

InitialModel builds the model.

func (*TextInputModel) Blur

func (m *TextInputModel) Blur()

Blur blurs the input. Once it is no longer focused it will no longer accept input.

func (*TextInputModel) Delete

func (m *TextInputModel) Delete() tea.Cmd

Delete deletes the rune in front of the cursor.

func (*TextInputModel) Focus

func (m *TextInputModel) Focus(maxChars int)

Focus focuses the input. If it is focused it will be accepting input.

func (TextInputModel) Focused

func (m TextInputModel) Focused() bool

Focus returns true if this input is focused.

func (TextInputModel) Init

func (m TextInputModel) Init() tea.Cmd

Init initializes the model.

func (*TextInputModel) Insert

func (m *TextInputModel) Insert(runes []rune) tea.Cmd

Insert inserts runes in front of the cursor.

func (*TextInputModel) MoveLeft

func (m *TextInputModel) MoveLeft()

MoveLeft moves the cursor the left once space.

func (*TextInputModel) MoveRight

func (m *TextInputModel) MoveRight()

MoveRight moves the cursor to right once space.

func (*TextInputModel) Resize

func (m *TextInputModel) Resize(width int)

Resize changes the size of the input.

func (*TextInputModel) SetPrompt

func (m *TextInputModel) SetPrompt(prompt string)

SetPrompt sets the prompt for the input.

func (*TextInputModel) SetText

func (m *TextInputModel) SetText(text string)

SetText sets the text inside the input.

func (TextInputModel) Text

func (m TextInputModel) Text() string

Text returns the current text in the input.

func (TextInputModel) Update

func (m TextInputModel) Update(msg tea.Msg) (TextInputModel, tea.Cmd)

Update handles a message.

func (TextInputModel) View

func (m TextInputModel) View() string

View renders the model.

Jump to

Keyboard shortcuts

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