Help us shape the future of Go! Take the 2026 Go Developer Survey

forminput

package
v1.40.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package forminput provides value-only text editing and ordered form navigation. Callers own key bindings, draft persistence, terminal I/O, and submission.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cycle

func Cycle[T comparable](order []T, current T, backwards bool) (T, bool)

Cycle wraps through visible focus IDs. Missing focus and empty orders preserve current and return false, letting each caller choose its recovery policy.

Types

type Editor

type Editor struct {
	Text   []rune
	Cursor int
}

Editor edits runes, not bytes. Cursor must be between zero and len(Text). The caller owns Text; operations may reuse its backing array.

func (*Editor) Backspace

func (e *Editor) Backspace()

func (*Editor) Clear

func (e *Editor) Clear()

func (*Editor) Delete

func (e *Editor) Delete()

func (*Editor) DeleteBefore

func (e *Editor) DeleteBefore()

func (*Editor) DeleteWordBefore

func (e *Editor) DeleteWordBefore()

func (*Editor) Insert

func (e *Editor) Insert(value string)

func (*Editor) LineEnd

func (e *Editor) LineEnd()

func (*Editor) LineStart

func (e *Editor) LineStart()

func (*Editor) Move

func (e *Editor) Move(delta int)

func (*Editor) MoveRow

func (e *Editor) MoveRow(down bool)

Jump to

Keyboard shortcuts

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