caret

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: 0 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction int
const (
	// NoDirection means that there was no Direction used
	// to move the caret.  It does not necessarily mean
	// that it didn't move.
	NoDirection Direction = iota

	Up
	Down
	Left
	Right
)

type Modifier

type Modifier int
const (
	// Select means that a caret movement should add to a selection.
	Select Modifier = 1 << iota

	// Multi means that caret movement should move multiple carets.
	Multi

	NoMod Modifier = 0
)

type Selection

type Selection struct {
	// At is the start of the selection. If Length == 0, then this is the caret
	// position.
	At int

	// Len is how many characters after At are also selected.
	Len int
}

A Selection is a position and length representing a range of selected text. Length == 0 means that this Selection is simply a caret.

Some UI libraries choose to display the caret at the beginning or end of a selection, but vidar will always treat a selection as if it does not have a caret. By default, caret movement left or right will deselect, leaving the caret at either the beginning or the end of the selection, respectively.

Jump to

Keyboard shortcuts

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