Documentation ¶
Overview ¶
Package cursor handles all the cursor and multicursor stuff.
Index ¶
- type Cursor
- type MultiCursor
- func (mc *MultiCursor) Append(cursor Cursor)
- func (mc *MultiCursor) Clear()
- func (mc MultiCursor) Cursors() []Cursor
- func (mc *MultiCursor) CycleNavMode()
- func (mc MultiCursor) Dup() MultiCursor
- func (mc MultiCursor) GetCol(idx int) int
- func (mc MultiCursor) GetCursor(idx int) Cursor
- func (mc MultiCursor) GetCursorRCC(idx int) (row, col, colwant int)
- func (mc MultiCursor) GetFirstCursor() Cursor
- func (mc MultiCursor) GetNavMode() NavMode
- func (mc MultiCursor) GetNavModeShort() string
- func (mc MultiCursor) GetRow(idx int) int
- func (mc MultiCursor) GetRowCol(idx int) (int, int)
- func (mc MultiCursor) GetRows() []int
- func (mc MultiCursor) GetRowsCols() map[int][]int
- func (mc MultiCursor) Length() int
- func (mc MultiCursor) MaxCol() int
- func (mc MultiCursor) MinMaxRow() (minRow, maxRow int)
- func (mc MultiCursor) NavModeIsAllTogether() bool
- func (mc MultiCursor) NavModeIsColumn() bool
- func (mc MultiCursor) NavModeIsDetached() bool
- func (mc *MultiCursor) OnePerLine()
- func (mc *MultiCursor) OuterMost()
- func (mc *MultiCursor) ReplaceMC(mc2 MultiCursor)
- func (mc *MultiCursor) ResetCursors(rows map[int][]int)
- func (mc *MultiCursor) ResetRowsCols(rowcol map[int][]int)
- func (mc *MultiCursor) Set(row, col, colwant int)
- func (mc *MultiCursor) SetCol(idx, col int)
- func (mc *MultiCursor) SetColumn()
- func (mc *MultiCursor) SetColwant(idx, colwant int)
- func (mc *MultiCursor) SetCursor(idx, row, col, colwant int)
- func (mc *MultiCursor) SetRow(idx, row int)
- func (mc *MultiCursor) Snapshot()
- type NavMode
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
CursorFromSlice creates a new Cursor object, from a slice of ints. The input slice is if the form [row, col, colwant].
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) 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) 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) 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.