field

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

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

Field represents a text field containing a string value, a newline representation, and a cursor position.

func New

func New(s string) *Field

New creates and returns a new Field initialized with the given string.

func (*Field) Backspace

func (m *Field) Backspace()

Backspace deletes the character to the left of the cursor, if possible, and moves the cursor left.

func (*Field) Cursor

func (m *Field) Cursor() int

Cursor returns the current cursor position within the Field value.

func (*Field) End

func (m *Field) End()

End moves the cursor to the end of the Field value.

func (*Field) Home

func (m *Field) Home()

Home moves the cursor to the beginning of the Field value.

func (*Field) Insert

func (m *Field) Insert(r rune)

Insert inserts the given rune at the cursor position and moves the cursor right.

func (*Field) InsertNL added in v0.1.5

func (m *Field) InsertNL()

InsertNL inserts a newline at the cursor position and moves the cursor right.

func (*Field) Left

func (m *Field) Left()

Left moves the cursor one character to the left, if possible.

func (*Field) Right

func (m *Field) Right()

Right moves the cursor one character to the right, if possible.

func (*Field) Set

func (m *Field) Set(value string)

Set updates the value of the Field and resets the cursor to the end of the new value.

func (*Field) String

func (m *Field) String() string

String returns the complete string value of the Field, including restored newlines.

func (*Field) Strings added in v0.1.5

func (m *Field) Strings() []string

Strings returns the Field value split into lines based on the default newline representation.

type FieldWithFocus

type FieldWithFocus struct {
	*Field
	*FocusState
}

func WithFocus

func WithFocus(field *Field) *FieldWithFocus

type FocusState

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

func (*FocusState) Blur

func (m *FocusState) Blur()

func (*FocusState) Focus

func (m *FocusState) Focus()

func (*FocusState) Focused

func (m *FocusState) Focused() bool

Jump to

Keyboard shortcuts

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