text

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MPL-2.0 Imports: 1 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State interface {
	// Len returns the length of text in the State.
	Len(context.Context) int

	// Pos returns the position within the text of the requested line and
	// column.
	Pos(ctx context.Context, line, col int) int

	// PosTuple returns the line and column within the text of the requested
	// position.
	PosTuple(ctx context.Context, pos int) (line, col int)

	// LineStart returns the position of the first character on the same line as
	// pos.
	LineStart(ctx context.Context, pos int) int

	// LineEnd returns the position of the next newline character (or the last
	// character in the file) starting at pos.
	LineEnd(ctx context.Context, pos int) int

	// Version returns the version of this text.
	Version(context.Context) int

	// Text returns the runes in State within the range [start,end) as a []rune.
	// This will make a copy of the stored text so that changing indexes will
	// not change this State.
	//
	// An end of -1 will include _all_ text.
	Text(_ context.Context, start, end int) []rune
}

State represents a state of the text in a text container (e.g. an editor). Once retrieved, it is read-only and safe for concurrent access.

Jump to

Keyboard shortcuts

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