textfield

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Source piecetree.Snapshot

	LastScrollValue piecetree.Snapshot
	// Buffer optionally binds native input to a document-owned piece tree.
	Buffer *input.TextBuffer

	Composition           string
	Placeholder           string
	Value                 string
	CommittedValue        string
	LastScrollComposition string
	LastScrollCaret       int
	Caret                 int
	MaxRunes              int
	FontSize              float64
	DPI                   float64
	Anchor                int
	// ScrollX is the signed horizontal text offset. Positive values move the
	// text right; negative values reveal the caret in overflowing values.
	ScrollX            float32
	LastScrollViewport float32
	Submitted          bool
	Password           bool
	LastScrollFocused  bool
	Selecting          bool
	ScrollInitialized  bool
	Focused            bool
	// contains filtered or unexported fields
}

func (Field) HistoryPosition

func (f Field) HistoryPosition() int

HistoryPosition and RestoreHistoryPosition support canceling a tentative undo or redo.

func (*Field) RecordEdit

func (f *Field) RecordEdit(previous Field)

RecordEdit records a committed native edit. Document-backed editors own their history; ordinary controls retain immutable strings without copying.

func (*Field) RestoreEdit

func (f *Field) RestoreEdit(redo bool)

func (*Field) RestoreHistoryPosition

func (f *Field) RestoreHistoryPosition(index int)

func (*Field) SetValue

func (f *Field) SetValue(value string)

SetValue updates the live value and clamps the selection to its rune length.

func (Field) Text

func (f Field) Text() piecetree.Snapshot

Jump to

Keyboard shortcuts

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