caret

package
v0.0.0-...-bbcbdef Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Select Mod = 1 << iota
	Word
	Whitespace

	Line       = Word | Whitespace
	SelectWord = Select | Word
	SelectLine = Select | Line

	NoMod Mod = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CaretHandler

type CaretHandler interface {
	Carets() []int
	SetCarets(...int)
}

type Commander

type Commander interface {
	Bindable(name string) bind.Bindable
	Execute(bind.Bindable)
}

type Controller

type Controller interface {
	Carets() []int
	MoveUp()
	SelectUp()
	MoveDown()
	SelectDown()
	MoveLeft()
	SelectLeft()
	MoveLeftByWord()
	SelectLeftByWord()
	MoveRight()
	SelectRight()
	MoveRightByWord()
	SelectRightByWord()
	MoveEnd()
	SelectEnd()
	MoveHome()
	SelectHome()
}

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 Mod

type Mod int

type MovedHook

type MovedHook interface {
	Moved(e text.Editor, carets []int)
}

MovedHook is a hook that needs to trigger after the carets have moved.

type Mover

type Mover struct {
	// contains filtered or unexported fields
}

func (*Mover) Bind

func (m *Mover) Bind(b bind.Bindable) (bind.HookedMultiOp, error)

func (*Mover) Exec

func (m *Mover) Exec() error

func (*Mover) For

func (m *Mover) For(dir Direction, mod Mod) bind.Bindable

func (*Mover) Name

func (*Mover) Name() string

func (*Mover) Reset

func (m *Mover) Reset()

func (*Mover) Store

func (m *Mover) Store(elem interface{}) bind.Status

func (*Mover) To

func (m *Mover) To(carets ...int) bind.Bindable

type MovingHook

type MovingHook interface {
	Moving(e text.Editor, d Direction, m Mod, carets []int) (newD Direction, newM Mod, newCarets []int)
}

MovingHook is a hook that needs to trigger when the caret is moving. If d and/or carets need to be modified by the hook before carets actually move, the MovingHook can return a different direction and/or slice of carets.

type OnEdit

type OnEdit struct {
	Commander Commander
}

func (*OnEdit) Applied

func (o *OnEdit) Applied(e text.Editor, edits []text.Edit)

func (*OnEdit) Name

func (o *OnEdit) Name() string

func (*OnEdit) OpName

func (o *OnEdit) OpName() string

Jump to

Keyboard shortcuts

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