Documentation ¶
Index ¶
- Constants
- func Abs(n int) int
- func ByteOffset(pos Loc, buf *Buffer) int
- func CommonSubstring(arr ...string) string
- func Contains(list []string, a string) bool
- func Count(s string) int
- func DefaultLocalSettings() map[string]interface{}
- func Diff(a, b Loc, buf *Buffer) int
- func EscapePath(path string) string
- func ExecuteTextEvent(t *TextEvent, buf *Buffer)
- func FSize(f *os.File) int64
- func FuncName(i interface{}) string
- func GetColor(color string) tcell.Style
- func GetColor256(color int) tcell.Color
- func GetLeadingWhitespace(str string) string
- func GetModTime(path string) (time.Time, bool)
- func GetPathAndCursorPosition(path string) (string, []string)
- func InBounds(pos Loc, buf *Buffer) bool
- func Insert(str string, pos int, value string) string
- func IsSpaces(str []byte) bool
- func IsSpacesOrTabs(str string) bool
- func IsStrWhitespace(str string) bool
- func IsWhitespace(c rune) bool
- func IsWordChar(str string) bool
- func MakeRelative(path, base string) (string, error)
- func Max(a, b int) int
- func Min(a, b int) int
- func NumOccurrences(s string, c byte) int
- func ParseBool(str string) (bool, error)
- func SetDefaultColorscheme(scheme Colorscheme)
- func ShortFuncName(i interface{}) string
- func ShowMultiCursor(screen tcell.Screen, x, y, i int)
- func Spaces(n int) string
- func StringToColor(str string) tcell.Color
- func StringToStyle(str string) tcell.Style
- func StringWidth(str string, tabsize int) int
- func ToCharPos(start Loc, buf *Buffer) int
- func UndoTextEvent(t *TextEvent, buf *Buffer)
- func WidthOfLargeRunes(str string, tabsize int) int
- type Buffer
- func (b *Buffer) End() Loc
- func (b *Buffer) FileType() string
- func (b *Buffer) FindMatchingBrace(braceType [2]rune, start Loc) Loc
- func (b *Buffer) GetName() string
- func (b *Buffer) IndentString() string
- func (b *Buffer) Len() (n int)
- func (b *Buffer) Line(n int) string
- func (b *Buffer) LineBytes(n int) []byte
- func (b *Buffer) LineRunes(n int) []rune
- func (b *Buffer) Lines(start, end int) []string
- func (b *Buffer) LinesNum() int
- func (b *Buffer) MergeCursors()
- func (b *Buffer) Modified() bool
- func (b *Buffer) MoveLinesDown(start int, end int)
- func (b *Buffer) MoveLinesUp(start int, end int)
- func (b *Buffer) RuneAt(loc Loc) rune
- func (b *Buffer) Start() Loc
- func (b *Buffer) UpdateCursors()
- type CellView
- type Char
- type Colorscheme
- type Cursor
- func (c *Cursor) AddLineToSelection()
- func (c *Cursor) AddWordToSelection()
- func (c *Cursor) CopySelection(target string)
- func (c *Cursor) DeleteSelection()
- func (c *Cursor) Down()
- func (c *Cursor) DownN(amount int)
- func (c *Cursor) End()
- func (c *Cursor) GetCharPosInLine(lineNum, visualPos int) int
- func (c *Cursor) GetSelection() string
- func (c *Cursor) GetVisualX() int
- func (c *Cursor) Goto(b Cursor)
- func (c *Cursor) GotoLoc(l Loc)
- func (c *Cursor) HasSelection() bool
- func (c *Cursor) Left()
- func (c *Cursor) Relocate()
- func (c *Cursor) ResetSelection()
- func (c *Cursor) Right()
- func (c *Cursor) RuneUnder(x int) rune
- func (c *Cursor) SelectLine()
- func (c *Cursor) SelectTo(loc Loc)
- func (c *Cursor) SelectWord()
- func (c *Cursor) SetSelectionEnd(pos Loc)
- func (c *Cursor) SetSelectionStart(pos Loc)
- func (c *Cursor) Start()
- func (c *Cursor) StartOfText()
- func (c *Cursor) StoreVisualX()
- func (c *Cursor) Up()
- func (c *Cursor) UpN(amount int)
- func (c *Cursor) WordLeft()
- func (c *Cursor) WordRight()
- type Delta
- type Element
- type EventHandler
- func (eh *EventHandler) ApplyDiff(new string)
- func (eh *EventHandler) Execute(t *TextEvent)
- func (eh *EventHandler) Insert(start Loc, text string)
- func (eh *EventHandler) MultipleReplace(deltas []Delta)
- func (eh *EventHandler) Redo()
- func (eh *EventHandler) RedoOneEvent()
- func (eh *EventHandler) Remove(start, end Loc)
- func (eh *EventHandler) Replace(start, end Loc, replace string)
- func (eh *EventHandler) Undo()
- func (eh *EventHandler) UndoOneEvent()
- type KeyBindings
- type Line
- type LineArray
- func (la *LineArray) DeleteByte(pos Loc)
- func (la *LineArray) DeleteFromStart(pos Loc)
- func (la *LineArray) DeleteLine(y int)
- func (la *LineArray) DeleteToEnd(pos Loc)
- func (la *LineArray) JoinLines(a, b int)
- func (la *LineArray) NewlineBelow(y int)
- func (la *LineArray) SaveString(useCrlf bool) string
- func (la *LineArray) Split(pos Loc)
- func (la *LineArray) String() string
- func (la *LineArray) Substr(start, end Loc) string
- type Loc
- type ScrollBar
- type Stack
- type TextEvent
- type View
- func (v *View) Backspace() bool
- func (v *View) Bottomline() int
- func (v *View) Center() bool
- func (v *View) Copy() bool
- func (v *View) CursorDown() bool
- func (v *View) CursorEnd() bool
- func (v *View) CursorLeft() bool
- func (v *View) CursorPageDown() bool
- func (v *View) CursorPageUp() bool
- func (v *View) CursorRight() bool
- func (v *View) CursorStart() bool
- func (v *View) CursorUp() bool
- func (v *View) Cut() bool
- func (v *View) CutLine() bool
- func (v *View) Delete() bool
- func (v *View) DeleteLine() bool
- func (v *View) DeleteWordLeft() bool
- func (v *View) DeleteWordRight() bool
- func (v *View) Draw(screen tcell.Screen) bool
- func (v *View) DuplicateLine() bool
- func (v *View) End() bool
- func (v *View) EndOfLine() bool
- func (v *View) Escape() bool
- func (v *View) ExecuteActions(actions []func(*View) bool) bool
- func (v *View) GetKeybindings() KeyBindings
- func (v *View) HalfPageDown() bool
- func (v *View) HalfPageUp() bool
- func (v *View) HandleEvent(event tcell.Event)
- func (v *View) IndentSelection() bool
- func (v *View) InputHandler() func(event *tcell.EventKey, _ func(p tview.Primitive))
- func (v *View) InsertNewline() bool
- func (v *View) InsertSpace() bool
- func (v *View) InsertTab() bool
- func (v *View) JumpToMatchingBrace() bool
- func (v *View) MoveLinesDown() bool
- func (v *View) MoveLinesUp() bool
- func (v *View) OpenBuffer(buf *Buffer)
- func (v *View) OutdentLine() bool
- func (v *View) OutdentSelection() bool
- func (v *View) PageDown() bool
- func (v *View) PageUp() bool
- func (v *View) ParagraphNext() bool
- func (v *View) ParagraphPrevious() bool
- func (v *View) Paste() bool
- func (v *View) Redo() bool
- func (v *View) Relocate() bool
- func (v *View) RemoveAllMultiCursors() bool
- func (v *View) RemoveMultiCursor() bool
- func (v *View) Retab() bool
- func (v *View) ScrollDown(n int)
- func (v *View) ScrollDownAction() bool
- func (v *View) ScrollUp(n int)
- func (v *View) ScrollUpAction() bool
- func (v *View) SelectAll() bool
- func (v *View) SelectDown() bool
- func (v *View) SelectLeft() bool
- func (v *View) SelectLine() bool
- func (v *View) SelectPageDown() bool
- func (v *View) SelectPageUp() bool
- func (v *View) SelectRight() bool
- func (v *View) SelectToEnd() bool
- func (v *View) SelectToEndOfLine() bool
- func (v *View) SelectToStart() bool
- func (v *View) SelectToStartOfLine() bool
- func (v *View) SelectUp() bool
- func (v *View) SelectWordLeft() bool
- func (v *View) SelectWordRight() bool
- func (v *View) SetCursor(c *Cursor) bool
- func (v *View) SetKeybindings(bindings KeyBindings)
- func (v *View) SetRect(x, y, width, height int)
- func (v *View) SkipMultiCursor() bool
- func (v *View) SpawnMultiCursor() bool
- func (v *View) SpawnMultiCursorSelect() bool
- func (v *View) Start() bool
- func (v *View) StartOfLine() bool
- func (v *View) ToggleOverwriteMode() bool
- func (v *View) ToggleRuler() bool
- func (v *View) Undo() bool
- func (v *View) WordLeft() bool
- func (v *View) WordRight() bool
Constants ¶
const ( ActionCursorUp = "CursorUp" ActionCursorDown = "CursorDown" ActionCursorPageUp = "CursorPageUp" ActionCursorPageDown = "CursorPageDown" ActionCursorLeft = "CursorLeft" ActionCursorRight = "CursorRight" ActionCursorStart = "CursorStart" ActionCursorEnd = "CursorEnd" ActionSelectToStart = "SelectToStart" ActionSelectToEnd = "SelectToEnd" ActionSelectUp = "SelectUp" ActionSelectDown = "SelectDown" ActionSelectLeft = "SelectLeft" ActionSelectRight = "SelectRight" ActionWordRight = "WordRight" ActionWordLeft = "WordLeft" ActionSelectWordRight = "SelectWordRight" ActionSelectWordLeft = "SelectWordLeft" ActionDeleteWordRight = "DeleteWordRight" ActionDeleteWordLeft = "DeleteWordLeft" ActionSelectLine = "SelectLine" ActionSelectToStartOfLine = "SelectToStartOfLine" ActionSelectToEndOfLine = "SelectToEndOfLine" ActionParagraphPrevious = "ParagraphPrevious" ActionParagraphNext = "ParagraphNext" ActionInsertNewline = "InsertNewline" ActionInsertSpace = "InsertSpace" ActionBackspace = "Backspace" ActionDelete = "Delete" ActionInsertTab = "InsertTab" ActionCenter = "Center" ActionUndo = "Undo" ActionRedo = "Redo" ActionCopy = "Copy" ActionCut = "Cut" ActionCutLine = "CutLine" ActionDuplicateLine = "DuplicateLine" ActionDeleteLine = "DeleteLine" ActionMoveLinesUp = "MoveLinesUp" ActionMoveLinesDown = "MoveLinesDown" ActionIndentSelection = "IndentSelection" ActionOutdentSelection = "OutdentSelection" ActionOutdentLine = "OutdentLine" ActionPaste = "Paste" ActionSelectAll = "SelectAll" ActionStart = "Start" ActionEnd = "End" ActionPageUp = "PageUp" ActionPageDown = "PageDown" ActionSelectPageUp = "SelectPageUp" ActionSelectPageDown = "SelectPageDown" ActionHalfPageUp = "HalfPageUp" ActionHalfPageDown = "HalfPageDown" ActionStartOfLine = "StartOfLine" ActionEndOfLine = "EndOfLine" ActionToggleRuler = "ToggleRuler" ActionToggleOverwriteMode = "ToggleOverwriteMode" ActionEscape = "Escape" ActionScrollUp = "ScrollUp" ActionScrollDown = "ScrollDown" ActionSpawnMultiCursor = "SpawnMultiCursor" ActionSpawnMultiCursorSelect = "SpawnMultiCursorSelect" ActionRemoveMultiCursor = "RemoveMultiCursor" ActionRemoveAllMultiCursors = "RemoveAllMultiCursors" ActionSkipMultiCursor = "SkipMultiCursor" ActionJumpToMatchingBrace = "JumpToMatchingBrace" ActionInsertEnter = "InsertEnter" ActionUnbindKey = "UnbindKey" )
Actions
const ( // TextEventInsert represents an insertion event TextEventInsert = 1 // TextEventRemove represents a deletion event TextEventRemove = -1 // TextEventReplace represents a replace event TextEventReplace = 0 )
const LargeFileThreshold = 50000
Variables ¶
This section is empty.
Functions ¶
func ByteOffset ¶
ByteOffset is just like ToCharPos except it counts bytes instead of runes
func CommonSubstring ¶
CommonSubstring gets a common substring among the inputs
func Count ¶
Count returns the length of a string in runes This is exactly equivalent to utf8.RuneCountInString(), just less characters
func DefaultLocalSettings ¶
func DefaultLocalSettings() map[string]interface{}
DefaultLocalSettings returns the default local settings Note that filetype is a local only option
func EscapePath ¶
EscapePath replaces every path separator in a given path with a %
func ExecuteTextEvent ¶
ExecuteTextEvent runs a text event
func FuncName ¶
func FuncName(i interface{}) string
FuncName returns the full name of a given function object
func GetColor256 ¶
GetColor256 returns the tcell color for a number between 0 and 255
func GetLeadingWhitespace ¶
GetLeadingWhitespace returns the leading whitespace of the given string
func GetModTime ¶
GetModTime returns the last modification time for a given file It also returns a boolean if there was a problem accessing the file
func GetPathAndCursorPosition ¶
GetPathAndCursorPosition returns a filename without everything following a `:` This is used for opening files like util.go:10:5 to specify a line and column Special cases like Windows Absolute path (C:\myfile.txt:10:5) are handled correctly.
func InBounds ¶
InBounds returns whether the given location is a valid character position in the given buffer
func IsSpacesOrTabs ¶
IsSpacesOrTabs checks if a given string contains only spaces and tabs
func IsStrWhitespace ¶
IsStrWhitespace returns true if the given string is all whitespace
func IsWhitespace ¶
IsWhitespace returns true if the given rune is a space, tab, or newline
func IsWordChar ¶
IsWordChar returns whether or not the string is a 'word character' If it is a unicode character, then it does not match Word characters are defined as [A-Za-z0-9_]
func MakeRelative ¶
MakeRelative will attempt to make a relative path between path and base
func NumOccurrences ¶
NumOccurrences counts the number of occurrences of a byte in a string
func ParseBool ¶
ParseBool is almost exactly like strconv.ParseBool, except it also accepts 'on' and 'off' as 'true' and 'false' respectively
func SetDefaultColorscheme ¶
func SetDefaultColorscheme(scheme Colorscheme)
SetDefaultColorscheme sets the current default colorscheme for new Views.
func ShortFuncName ¶
func ShortFuncName(i interface{}) string
ShortFuncName returns the name only of a given function object
func ShowMultiCursor ¶
ShowMultiCursor will display a cursor at a location If i == 0 then the terminal cursor will be used Otherwise a fake cursor will be drawn at the position
func StringToColor ¶
StringToColor returns a tcell color from a string representation of a color We accept either bright... or light... to mean the brighter version of a color
func StringToStyle ¶
StringToStyle returns a style from a string The strings must be in the format "extra foregroundcolor,backgroundcolor" The 'extra' can be bold, reverse, or underline
func StringWidth ¶
StringWidth returns the width of a string where tabs count as `tabsize` width
func UndoTextEvent ¶
UndoTextEvent undoes a text event
func WidthOfLargeRunes ¶
WidthOfLargeRunes searches all the runes in a string and counts up all the widths of runes that have a width larger than 1 (this also counts tabs as `tabsize` width)
Types ¶
type Buffer ¶
type Buffer struct { // The eventhandler for undo/redo *EventHandler // This stores all the text in the buffer as an array of lines *LineArray // The path to the loaded file, if any Path string Cursor Cursor // Whether or not the buffer has been modified since it was opened IsModified bool // NumLines is the number of lines in the buffer NumLines int // Buffer local settings Settings map[string]interface{} // contains filtered or unexported fields }
Buffer stores the text for files that are loaded into the text editor It uses a rope to efficiently store the string and contains some simple functions for saving and wrapper functions for modifying the rope
func NewBufferFromString ¶
NewBufferFromString creates a new buffer containing the given string
func (*Buffer) FindMatchingBrace ¶
FindMatchingBrace returns the location in the buffer of the matching bracket It is given a brace type containing the open and closing character, (for example '{' and '}') as well as the location to match from
func (*Buffer) GetName ¶
GetName returns the name that should be displayed in the statusline for this buffer
func (*Buffer) IndentString ¶
IndentString returns a string representing one level of indentation
func (*Buffer) MergeCursors ¶
func (b *Buffer) MergeCursors()
MergeCursors merges any cursors that are at the same position into one cursor
func (*Buffer) MoveLinesDown ¶
MoveLinesDown moves the range of lines down one row
func (*Buffer) MoveLinesUp ¶
MoveLinesUp moves the range of lines up one row
func (*Buffer) UpdateCursors ¶
func (b *Buffer) UpdateCursors()
UpdateCursors updates all the cursors indicies
type Colorscheme ¶
Colorscheme is a map from string to style -- it represents a colorscheme
func ParseColorscheme ¶
func ParseColorscheme(text string) Colorscheme
ParseColorscheme parses the text definition for a colorscheme and returns the corresponding object Colorschemes are made up of color-link statements linking a color group to a list of colors For example, color-link keyword (blue,red) makes all keywords have a blue foreground and red background
type Cursor ¶
type Cursor struct { Loc // Last cursor x position LastVisualX int // The current selection as a range of character numbers (inclusive) CurSelection [2]Loc // The original selection as a range of character numbers // This is used for line and word selection where it is necessary // to know what the original selection was OrigSelection [2]Loc // Which cursor index is this (for multiple cursors) Num int // contains filtered or unexported fields }
The Cursor struct stores the location of the cursor in the view The complicated part about the cursor is storing its location. The cursor must be displayed at an x, y location, but since the buffer uses a rope to store text, to insert text we must have an index. It is also simpler to use character indicies for other tasks such as selection.
func (*Cursor) AddLineToSelection ¶
func (c *Cursor) AddLineToSelection()
AddLineToSelection adds the current line to the selection
func (*Cursor) AddWordToSelection ¶
func (c *Cursor) AddWordToSelection()
AddWordToSelection adds the word the cursor is currently on to the selection
func (*Cursor) CopySelection ¶
CopySelection copies the user's selection to either "primary" or "clipboard"
func (*Cursor) DeleteSelection ¶
func (c *Cursor) DeleteSelection()
DeleteSelection deletes the currently selected text
func (*Cursor) GetCharPosInLine ¶
GetCharPosInLine gets the char position of a visual x y coordinate (this is necessary because tabs are 1 char but 4 visual spaces)
func (*Cursor) GetSelection ¶
GetSelection returns the cursor's selection
func (*Cursor) GetVisualX ¶
GetVisualX returns the x value of the cursor in visual spaces
func (*Cursor) Goto ¶
Goto puts the cursor at the given cursor's location and gives the current cursor its selection too
func (*Cursor) GotoLoc ¶
GotoLoc puts the cursor at the given cursor's location and gives the current cursor its selection too
func (*Cursor) HasSelection ¶
HasSelection returns whether or not the user has selected anything
func (*Cursor) Left ¶
func (c *Cursor) Left()
Left moves the cursor left one cell (if possible) or to the previous line if it is at the beginning
func (*Cursor) Relocate ¶
func (c *Cursor) Relocate()
Relocate makes sure that the cursor is inside the bounds of the buffer If it isn't, it moves it to be within the buffer's lines
func (*Cursor) ResetSelection ¶
func (c *Cursor) ResetSelection()
ResetSelection resets the user's selection
func (*Cursor) Right ¶
func (c *Cursor) Right()
Right moves the cursor right one cell (if possible) or to the next line if it is at the end
func (*Cursor) SelectWord ¶
func (c *Cursor) SelectWord()
SelectWord selects the word the cursor is currently on
func (*Cursor) SetSelectionEnd ¶
SetSelectionEnd sets the end of the selection
func (*Cursor) SetSelectionStart ¶
SetSelectionStart sets the start of the selection
func (*Cursor) Start ¶
func (c *Cursor) Start()
Start moves the cursor to the start of the line it is on
func (*Cursor) StartOfText ¶
func (c *Cursor) StartOfText()
StartOfText moves the cursor to the first non-whitespace rune of the line it is on
func (*Cursor) StoreVisualX ¶
func (c *Cursor) StoreVisualX()
StoreVisualX stores the current visual x value in the cursor
type EventHandler ¶
type EventHandler struct { UndoStack *Stack RedoStack *Stack // contains filtered or unexported fields }
EventHandler executes text manipulations and allows undoing and redoing
func NewEventHandler ¶
func NewEventHandler(buf *Buffer) *EventHandler
NewEventHandler returns a new EventHandler
func (*EventHandler) ApplyDiff ¶
func (eh *EventHandler) ApplyDiff(new string)
ApplyDiff takes a string and runs the necessary insertion and deletion events to make the buffer equal to that string This means that we can transform the buffer into any string and still preserve undo/redo through insert and delete events
func (*EventHandler) Execute ¶
func (eh *EventHandler) Execute(t *TextEvent)
Execute a textevent and add it to the undo stack
func (*EventHandler) Insert ¶
func (eh *EventHandler) Insert(start Loc, text string)
Insert creates an insert text event and executes it
func (*EventHandler) MultipleReplace ¶
func (eh *EventHandler) MultipleReplace(deltas []Delta)
MultipleReplace creates an multiple insertions executes them
func (*EventHandler) RedoOneEvent ¶
func (eh *EventHandler) RedoOneEvent()
RedoOneEvent redoes one event
func (*EventHandler) Remove ¶
func (eh *EventHandler) Remove(start, end Loc)
Remove creates a remove text event and executes it
func (*EventHandler) Replace ¶
func (eh *EventHandler) Replace(start, end Loc, replace string)
Replace deletes from start to end and replaces it with the given string
func (*EventHandler) UndoOneEvent ¶
func (eh *EventHandler) UndoOneEvent()
UndoOneEvent undoes one event
type KeyBindings ¶
KeyBindings associates key presses with view actions.
var DefaultKeyBindings KeyBindings
func NewKeyBindings ¶
func NewKeyBindings(bindings map[string]string) KeyBindings
NewKeyBindings returns a new set of keybindings from the given set of binding descriptions.
func (KeyBindings) BindKey ¶
func (bindings KeyBindings) BindKey(key string, actions string) KeyBindings
BindKey binds a key to a list of actions. If the key is not found or if any action is not found, this function has no effect.
func (KeyBindings) BindKeys ¶
func (bindings KeyBindings) BindKeys(keys map[string]string) KeyBindings
BindKeys binds a set of keys to actions.
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
A Line contains the data in bytes as well as a highlight state, match and a flag for whether the highlighting needs to be updated
type LineArray ¶
type LineArray struct {
// contains filtered or unexported fields
}
A LineArray simply stores and array of lines and makes it easy to insert and delete in it
func NewLineArray ¶
NewLineArray returns a new line array from an array of bytes
func (*LineArray) DeleteByte ¶
DeleteByte deletes the byte at a position
func (*LineArray) DeleteFromStart ¶
DeleteFromStart deletes from the start of a line to the position
func (*LineArray) DeleteLine ¶
DeleteLine deletes the line number
func (*LineArray) DeleteToEnd ¶
DeleteToEnd deletes from the end of a line to the position
func (*LineArray) NewlineBelow ¶
NewlineBelow adds a newline below the given line number
func (*LineArray) SaveString ¶
SaveString returns the string that should be written to disk when the line array is saved It is the same as string but uses crlf or lf line endings depending
type Loc ¶
type Loc struct {
X, Y int
}
Loc stores a location
func FromCharPos ¶
FromCharPos converts from a character position to an x, y position
func (Loc) GreaterEqual ¶
GreaterEqual returns true if b is greater than or equal to b
func (Loc) GreaterThan ¶
GreaterThan returns true if b is bigger
type ScrollBar ¶
type ScrollBar struct {
// contains filtered or unexported fields
}
ScrollBar represents an optional scrollbar that can be used
type Stack ¶
Stack is a simple implementation of a LIFO stack for text events
type View ¶
type View struct { *tview.Box // A pointer to the buffer's cursor for ease of access Cursor *Cursor // The topmost line, used for vertical scrolling Topline int // Specifies whether or not this view is readonly Readonly bool // The buffer Buf *Buffer // contains filtered or unexported fields }
The View struct stores information about a view into a buffer. It stores information about the cursor, and the viewport that the user sees the buffer from.
func (*View) Bottomline ¶
Bottomline returns the line number of the lowest line in the view You might think that this is obviously just v.Topline + v.height but if softwrap is enabled things get complicated since one buffer line can take up multiple lines in the view
func (*View) CursorPageDown ¶
CursorPageDown places the cursor a page up
func (*View) CursorPageUp ¶
CursorPageUp places the cursor a page up
func (*View) CursorStart ¶
CursorStart moves the cursor to the start of the buffer
func (*View) DeleteWordLeft ¶
DeleteWordLeft deletes the word to the left of the cursor
func (*View) DeleteWordRight ¶
DeleteWordRight deletes the word to the right of the cursor
func (*View) DuplicateLine ¶
DuplicateLine duplicates the current line or selection
func (*View) ExecuteActions ¶
Execute actions executes the supplied actions
func (*View) GetKeybindings ¶
func (v *View) GetKeybindings() KeyBindings
GetKeyBindings gets the keybindings for this view.
func (*View) HalfPageDown ¶
HalfPageDown scrolls the view down half a page
func (*View) HalfPageUp ¶
HalfPageUp scrolls the view up half a page
func (*View) HandleEvent ¶
HandleEvent handles an event passed by the main loop
func (*View) IndentSelection ¶
IndentSelection indents the current selection
func (*View) InputHandler ¶
InputHandler returns a handler which received key events when this view has focus,
func (*View) InsertNewline ¶
InsertNewline inserts a newline plus possible some whitespace if autoindent is on
func (*View) JumpToMatchingBrace ¶
JumpToMatchingBrace moves the cursor to the matching brace if it is currently on a brace
func (*View) MoveLinesDown ¶
MoveLinesDown moves down the current line or selected lines if any
func (*View) MoveLinesUp ¶
MoveLinesUp moves up the current line or selected lines if any
func (*View) OpenBuffer ¶
OpenBuffer opens a new buffer in this view. This resets the topline, event handler and cursor.
func (*View) OutdentLine ¶
OutdentLine moves the current line back one indentation
func (*View) OutdentSelection ¶
OutdentSelection takes the current selection and moves it back one indent level
func (*View) ParagraphNext ¶
ParagraphNext moves the cursor to the next empty line, or end of the buffer if there's none
func (*View) ParagraphPrevious ¶
ParagraphPrevious moves the cursor to the previous empty line, or beginning of the buffer if there's none
func (*View) Paste ¶
Paste whatever is in the system clipboard into the buffer Delete and paste if the user has a selection
func (*View) Relocate ¶
Relocate moves the view window so that the cursor is in view This is useful if the user has scrolled far away, and then starts typing
func (*View) RemoveAllMultiCursors ¶
RemoveAllMultiCursors removes all cursors except the base cursor
func (*View) RemoveMultiCursor ¶
RemoveMultiCursor removes the latest multiple cursor
func (*View) Retab ¶
Retab changes all tabs to spaces or all spaces to tabs depending on the user's settings
func (*View) ScrollDown ¶
ScrollDown scrolls the view down n lines (if possible)
func (*View) ScrollDownAction ¶
ScrollDownAction scrolls the view up
func (*View) ScrollUpAction ¶
ScrollUpAction scrolls the view up
func (*View) SelectLeft ¶
SelectLeft selects the character to the left of the cursor
func (*View) SelectLine ¶
SelectLine selects the entire current line
func (*View) SelectPageDown ¶
SelectPageDown selects down one page
func (*View) SelectRight ¶
SelectRight selects the character to the right of the cursor
func (*View) SelectToEnd ¶
SelectToEnd selects the text from the cursor to the end of the buffer
func (*View) SelectToEndOfLine ¶
SelectToEndOfLine selects to the end of the current line
func (*View) SelectToStart ¶
SelectToStart selects the text from the cursor to the start of the buffer
func (*View) SelectToStartOfLine ¶
SelectToStartOfLine selects to the start of the current line
func (*View) SelectWordLeft ¶
SelectWordLeft selects the word to the left of the cursor
func (*View) SelectWordRight ¶
SelectWordRight selects the word to the right of the cursor
func (*View) SetKeybindings ¶
func (v *View) SetKeybindings(bindings KeyBindings)
SetKeybindings sets the keybindings for this view.
func (*View) SkipMultiCursor ¶
SkipMultiCursor moves the current multiple cursor to the next available position
func (*View) SpawnMultiCursor ¶
SpawnMultiCursor creates a new multiple cursor at the next occurrence of the current selection or current word
func (*View) SpawnMultiCursorSelect ¶
SpawnMultiCursorSelect adds a cursor at the beginning of each line of a selection
func (*View) StartOfLine ¶
StartOfLine moves the cursor to the start of the line
func (*View) ToggleOverwriteMode ¶
ToggleOverwriteMode lets the user toggle the text overwrite mode
func (*View) ToggleRuler ¶
ToggleRuler turns line numbers off and on