cursor

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package cursor handles all the cursor and multicursor stuff.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cursor

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

Cursor keeps track of the row, col of a cursor, and also the wanted column (colwant) of the cursor. The wanted column is the column the cursor would like to be in, if the line were long enough.

func CursorFromSlice added in v0.6.0

func CursorFromSlice(s []int) Cursor

CursorFromSlice creates a new Cursor object, from a slice of ints. The input slice is if the form [row, col, colwant].

func MakeCursor

func MakeCursor(row, col int) Cursor

MakeCursor creates a new Cursor object.

func (Cursor) Col

func (cursor Cursor) Col() int

func (Cursor) Colwant

func (cursor Cursor) Colwant() int

func (Cursor) Dup

func (cursor Cursor) Dup() Cursor

Dup duplicates a cursor object.

func (Cursor) Row

func (cursor Cursor) Row() int

func (Cursor) RowCol

func (cursor Cursor) RowCol() (int, int)

RowCol returns the row and column of the cursor.

func (*Cursor) Set

func (cursor *Cursor) Set(row, col, colwant int)

type MultiCursor

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

MultiCursor is a set of Cursors.

func MakeMultiCursor

func MakeMultiCursor() MultiCursor

MakeMultiCursor Creates a new MultiCursor.

func (*MultiCursor) Append

func (mc *MultiCursor) Append(cursor Cursor)

Add appends another cursor.

func (*MultiCursor) Clear

func (mc *MultiCursor) Clear()

Clear keeps only the first cursor.

func (MultiCursor) Cursors

func (mc MultiCursor) Cursors() []Cursor

Cursors returns the list of cursors.

func (*MultiCursor) CycleNavMode added in v0.6.1

func (mc *MultiCursor) CycleNavMode()

CycleNavMode cycles through the three nav modes.

func (MultiCursor) Dup

func (mc MultiCursor) Dup() MultiCursor

Dup duplicates a MC object.

func (MultiCursor) GetCol

func (mc MultiCursor) GetCol(idx int) int

func (MultiCursor) GetCursor

func (mc MultiCursor) GetCursor(idx int) Cursor

GetCursor returns a cursor by index.

func (MultiCursor) GetCursorRCC

func (mc MultiCursor) GetCursorRCC(idx int) (row, col, colwant int)

GetCursorRCC gets the (row, col, colwant) of a cursor by index.

func (MultiCursor) GetFirstCursor

func (mc MultiCursor) GetFirstCursor() Cursor

Get FirstCursor returns the first cursor (by row).

func (MultiCursor) GetNavMode added in v0.6.1

func (mc MultiCursor) GetNavMode() NavMode

GetNavMode returns the current navigation mode.

func (MultiCursor) GetNavModeShort added in v0.6.1

func (mc MultiCursor) GetNavModeShort() string

GetNavModeShort returns a 1 character representation of the nav mode.

func (MultiCursor) GetRow

func (mc MultiCursor) GetRow(idx int) int

func (MultiCursor) GetRowCol

func (mc MultiCursor) GetRowCol(idx int) (int, int)

func (MultiCursor) GetRows added in v0.6.0

func (mc MultiCursor) GetRows() []int

GetRows returns a list of (integer) rows that contain cursors.

func (MultiCursor) GetRowsCols added in v0.6.0

func (mc MultiCursor) GetRowsCols() map[int][]int

GetRowsCols returns a map of cursor positions. The map keys are rows (integers), and the values are lists of cursor positions.

func (MultiCursor) Length

func (mc MultiCursor) Length() int

Length returns the number of cursors.

func (MultiCursor) MaxCol added in v0.4.2

func (mc MultiCursor) MaxCol() int

MaxCol returns the largest column value among cursors.

func (MultiCursor) MinMaxRow

func (mc MultiCursor) MinMaxRow() (minRow, maxRow int)

Return the smallest and largest row from all the cursors.

func (MultiCursor) NavModeIsAllTogether added in v0.6.1

func (mc MultiCursor) NavModeIsAllTogether() bool

NavModeIsAllTogether returns true if navMode is AllTogether.

func (MultiCursor) NavModeIsColumn added in v0.6.1

func (mc MultiCursor) NavModeIsColumn() bool

NavModeIsColumn returns true if navMode is Column.

func (MultiCursor) NavModeIsDetached added in v0.6.1

func (mc MultiCursor) NavModeIsDetached() bool

NavModeIsDetached returns true if navMode is Detached.

func (*MultiCursor) OnePerLine added in v0.6.0

func (mc *MultiCursor) OnePerLine()

OnePerLine keeps only the first cursor on each line.

func (*MultiCursor) OuterMost

func (mc *MultiCursor) OuterMost()

OuterMost removes all cursors except the the most extreme. Length will be 2 after this operation.

func (*MultiCursor) ReplaceMC

func (mc *MultiCursor) ReplaceMC(mc2 MultiCursor)

ReplaceMC sets the list of cursors to be the list of cursors from another MC object.

func (*MultiCursor) ResetCursors added in v0.6.0

func (mc *MultiCursor) ResetCursors(rows map[int][]int)

ResetCursors manually sets all the cursor positions. This is useful for a full cursor reset.

func (*MultiCursor) ResetRowsCols added in v0.6.0

func (mc *MultiCursor) ResetRowsCols(rowcol map[int][]int)

ResetRowsCols creates a new MultiCursor object from a map of row, column positions.

func (*MultiCursor) Set

func (mc *MultiCursor) Set(row, col, colwant int)

func (*MultiCursor) SetCol

func (mc *MultiCursor) SetCol(idx, col int)

func (*MultiCursor) SetColumn

func (mc *MultiCursor) SetColumn()

SetColumn sets the col of each cursor.

func (*MultiCursor) SetColwant

func (mc *MultiCursor) SetColwant(idx, colwant int)

func (*MultiCursor) SetCursor

func (mc *MultiCursor) SetCursor(idx, row, col, colwant int)

SetCursor sets the position of the cursor identified by index.

func (*MultiCursor) SetRow

func (mc *MultiCursor) SetRow(idx, row int)

func (*MultiCursor) Snapshot

func (mc *MultiCursor) Snapshot()

Snapshot adds the current primary cursor row,col as a new cursor to the list. It is the primary way the user will add cursors to the MC cursor list.

type NavMode int
const (
	Column      NavMode = 0
	AllTogether NavMode = 1
	Detached    NavMode = 2
)

Jump to

Keyboard shortcuts

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