textinput

package
v2.7.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package textinput provides a text-inputting controller. This package is experimental and the API might be changed in the future.

This package is supported by macOS and Web browsers so far.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(x, y int) (states chan State, close func())

Start starts text inputting. Start returns a channel to send the state repeatedly, and a function to end the text inputting.

Start returns nil and nil if the current environment doesn't support this package.

Types

type State

type State struct {
	// Text represents the current inputting text.
	Text string

	// CompositionSelectionStartInBytes represents the start position of the selection in bytes.
	CompositionSelectionStartInBytes int

	// CompositionSelectionStartInBytes represents the end position of the selection in bytes.
	CompositionSelectionEndInBytes int

	// Committed reports whether the current Text is the settled text.
	Committed bool
}

State represents the current state of text inputting.

Jump to

Keyboard shortcuts

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