text

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(i *Text)

func WithBackgroundStyle

func WithBackgroundStyle(style *style.Style) Option

WithBackgroundStyle set the background style

func WithBlinkSpeed

func WithBlinkSpeed(blinkSpeed time.Duration) Option

WithBlinkSpeed set the blink speed

func WithCharLimit

func WithCharLimit(charLimit int) Option

WithCharLimit is the maximum amount of characters this input element will accept. If 0 or less, there's no limit.

func WithCursorStyle

func WithCursorStyle(style *style.Style) Option

WithCursorStyle setthe cursor style

func WithEchoCharacter

func WithEchoCharacter(echoCharacter rune) Option

WithEchoCharacter setthe echo char shape

func WithEchoMode

func WithEchoMode(echoMode components.EchoMode) Option

WithEchoMode sets the input behavior of the text input field.

func WithPlaceholder

func WithPlaceholder(placeholder string) Option

WithPlaceholder set the placeholder

func WithPlaceholderStyle

func WithPlaceholderStyle(style *style.Style) Option

WithPlaceholderStyle set the placeholder style

func WithPrompt

func WithPrompt(prompt string) Option

WithPrompt set the prompt

func WithPromptStyle

func WithPromptStyle(style *style.Style) Option

WithPromptStyle set the prompt style

func WithQuitKey

func WithQuitKey(quitKey key.Binding) Option

WithQuitKey bindQuitKey,default is "enter"

func WithTextStyle

func WithTextStyle(style *style.Style) Option

WithTextStyle set the text style

type Text

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

func New

func New(ops ...Option) *Text

func (*Text) Apply

func (i *Text) Apply(ops ...Option) *Text

Apply options on Text

func (i *Text) Blink() bool

Blink returns whether or not to draw the cursor.

func (*Text) Blur

func (i *Text) Blur()

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.

func (*Text) Cursor

func (i *Text) Cursor() int

Cursor returns the cursor position.

func (*Text) CursorEnd

func (i *Text) CursorEnd()

CursorEnd moves the cursor to the end of the input field.

func (*Text) CursorMode

func (i *Text) CursorMode() components.CursorMode

CursorMode returns the model's cursor mode. For available cursor modes, see type CursorMode.

func (*Text) CursorStart

func (i *Text) CursorStart()

CursorStart moves the cursor to the start of the input field.

func (*Text) Display

func (i *Text) Display() error

func (*Text) Focus

func (i *Text) Focus()

Focus sets the Focus state on the model. When the model is in Focus it can receive keyboard input and the cursor will be hidden.

func (*Text) Focused

func (i *Text) Focused() bool

Focused returns the focus state on the model.

func (*Text) Quit

func (i *Text) Quit()

Quit input

func (*Text) Reset

func (i *Text) Reset() bool

Reset sets the input to its default state with no input. Returns whether or not the cursor blink should reset.

func (*Text) SetCursor

func (i *Text) SetCursor(pos int)

SetCursor 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.

func (*Text) SetCursorMode

func (i *Text) SetCursorMode(model components.CursorMode)

SetCursorMode sets the model's cursor mode. This method returns a command.

For available cursor modes, see type CursorMode.

func (*Text) Value

func (i *Text) Value() string

Value returns the value of the text input.

Jump to

Keyboard shortcuts

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