Documentation ¶
Index ¶
- func GetFileExt(filename string) string
- type BufferHist
- func (bh *BufferHist) Current() (buffer.Buffer, cursor.MultiCursor)
- func (bh *BufferHist) ForceSnapshot(buff buffer.Buffer, mc cursor.MultiCursor)
- func (bh *BufferHist) Next() (buffer.Buffer, cursor.MultiCursor)
- func (bh *BufferHist) NextSaved() (buffer.Buffer, cursor.MultiCursor)
- func (bh *BufferHist) Prev() (buffer.Buffer, cursor.MultiCursor)
- func (bh *BufferHist) PrevSaved() (buffer.Buffer, cursor.MultiCursor)
- func (bh *BufferHist) Snapshot(buff buffer.Buffer, mc cursor.MultiCursor)
- func (bh *BufferHist) SnapshotSaved()
- type BufferState
- type File
- func (file *File) AddCursor()
- func (file *File) AddCursorCol()
- func (file *File) AllLineBa(term string)
- func (file *File) AllLineFo(term string)
- func (file *File) AskReplace(searchTerm, replaceTerm string, row, col int, replaceAll bool) error
- func (file *File) Backspace()
- func (file *File) ClearCursors()
- func (file *File) Close() bool
- func (file *File) ColorBracketMatch(rows int)
- func (file *File) ComputeIndent()
- func (file *File) CursorAlign()
- func (file *File) CursorDown(n int)
- func (file *File) CursorGoTo(row, col int)
- func (file *File) CursorLeft()
- func (file *File) CursorRight()
- func (file *File) CursorUnalign()
- func (file *File) CursorUp(n int)
- func (file *File) Cut() []string
- func (file *File) CutToEndOfLine()
- func (file *File) CutToStartOfLine()
- func (file *File) Delete()
- func (file *File) EndOfLine()
- func (file *File) FileChanged() bool
- func (file *File) Flush()
- func (file *File) Fmt(selection ...bool) error
- func (file *File) ForceSnapshot()
- func (file *File) GetCursor(idx int) (int, int)
- func (file *File) GetRowCol(idx int) (int, int)
- func (file *File) InsertChar(ch rune)
- func (file *File) InsertStr(str string)
- func (file *File) IsModified() bool
- func (file *File) Justify()
- func (file *File) Length() int
- func (file *File) MarkedSearch(searchTerm string, loop bool) (row, col int, err error)
- func (file *File) Newline()
- func (file *File) NextWord()
- func (file *File) NotifyUser(msg string)
- func (file *File) PageDown()
- func (file *File) PageUp()
- func (file *File) Paste(strs []string)
- func (file *File) PrevWord()
- func (file *File) ReadFile(name string, wgs ...*sync.WaitGroup)
- func (file *File) Redo()
- func (file *File) RedoSaved()
- func (file *File) Refresh()
- func (file *File) Reload(wgs ...*sync.WaitGroup)
- func (file *File) RequestFlush()
- func (file *File) RequestSave()
- func (file *File) Save()
- func (file *File) ScrollDown()
- func (file *File) ScrollLeft()
- func (file *File) ScrollRight()
- func (file *File) ScrollUp()
- func (file *File) SearchFromCursor(searchTerm string) (row, col int, err error)
- func (file *File) SearchFromStart(searchTerm string) (row, col int, err error)
- func (file *File) SearchLineBa(term string)
- func (file *File) SearchLineFo(term string)
- func (file *File) SetCompleter(f func(prefix string) []string)
- func (file *File) SetLineLen()
- func (file *File) SetTabStr()
- func (file *File) SetTabWidth()
- func (file *File) Slice(nRows, nCols int) []string
- func (file *File) Snapshot()
- func (file *File) SnapshotSaved()
- func (file *File) StartOfLine()
- func (file *File) ToCorpus(row, col int) string
- func (file *File) ToString() string
- func (file *File) ToggleAutoFmt()
- func (file *File) ToggleAutoIndent()
- func (file *File) ToggleAutoTab()
- func (file *File) ToggleMCMode()
- func (file *File) UnJustify()
- func (file *File) Undo()
- func (file *File) UndoSaved()
- func (file *File) UnsetTabStr()
- func (file *File) WriteStatus(row, col int)
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFileExt ¶ added in v0.6.0
GetFileExt returns the filename extension.
Types ¶
type BufferHist ¶
type BufferHist struct {
// contains filtered or unexported fields
}
BufferHist manages a history of buffer states.
func NewBufferHist ¶
func NewBufferHist(buffer buffer.Buffer, cursor cursor.MultiCursor) *BufferHist
NewBufferHist creates a new BufferHist object initialized with the current state.
func (*BufferHist) Current ¶
func (bh *BufferHist) Current() (buffer.Buffer, cursor.MultiCursor)
Current returns the current buffer snapshot..
func (*BufferHist) ForceSnapshot ¶ added in v0.3.3
func (bh *BufferHist) ForceSnapshot(buff buffer.Buffer, mc cursor.MultiCursor)
ForceSnapshot forces a snapshot rather than requesting one.
func (*BufferHist) Next ¶
func (bh *BufferHist) Next() (buffer.Buffer, cursor.MultiCursor)
Next bumps the current pointer to the next state (redo).
func (*BufferHist) NextSaved ¶ added in v0.3.4
func (bh *BufferHist) NextSaved() (buffer.Buffer, cursor.MultiCursor)
NextSaved bumps the current pointer to the next saved state (macro redo).
func (*BufferHist) Prev ¶
func (bh *BufferHist) Prev() (buffer.Buffer, cursor.MultiCursor)
Prev bumps the current pointer to the previous state (undo).
func (*BufferHist) PrevSaved ¶ added in v0.3.4
func (bh *BufferHist) PrevSaved() (buffer.Buffer, cursor.MultiCursor)
PrevSaved bumps the current pointer to the previous saved state (macro undo).
func (*BufferHist) Snapshot ¶
func (bh *BufferHist) Snapshot(buff buffer.Buffer, mc cursor.MultiCursor)
Snapshot places a snapshot request onto the snapshot queue.
func (*BufferHist) SnapshotSaved ¶ added in v0.3.4
func (bh *BufferHist) SnapshotSaved()
SnapshotSaved toggles on the "saved" attribute for the current state.
type BufferState ¶ added in v0.3.4
type BufferState struct {
// contains filtered or unexported fields
}
BufferState contains a snapshot of the buffer state, including multicursor positions.
func NewBufferState ¶ added in v0.3.4
func NewBufferState(buff buffer.Buffer, mc cursor.MultiCursor) *BufferState
NewBufferState creates a new buffer state snapshot from the current state.
type File ¶
type File struct { MultiCursor cursor.MultiCursor // For autocompletion. Passed in by editor. AutoComplete func(prefix string) []string Name string SyntaxRules *syntaxcolor.SyntaxRules // contains filtered or unexported fields }
File contains all the details about a given file. This includes: name, buffer, buffer history, file-specific settings, etc.
func NewFile ¶
func NewFile(name string, flushChan chan struct{}, screen *terminal.Screen, cfg config.Config, wg *sync.WaitGroup) *File
NewFile creates a new File object. It reads in the specified file and ingests the specified configuration.
func (*File) AddCursor ¶
func (file *File) AddCursor()
AddCursor sets the current main cursor as a new multicursor member.
func (*File) AddCursorCol ¶
func (file *File) AddCursorCol()
AddCursorCol creates a multicursor set along a column.
func (*File) AllLineBa ¶ added in v0.6.0
AllLineBa is like SearchLineBa, but can return multiple matches on the same line.
func (*File) AllLineFo ¶ added in v0.6.0
AllLineFo is like SearchLineFo, but can return multiple matches on the same line.
func (*File) AskReplace ¶ added in v0.3.1
AskReplace replaces each instance of searchTerm with replaceTerm, asking the user for confirmation each time.
func (*File) Backspace ¶
func (file *File) Backspace()
Backspace removes the character before the cursor.
func (*File) ClearCursors ¶
func (file *File) ClearCursors()
ClearCursors clears out the multicursors.
func (*File) Close ¶
Close doesn't actually close anything (b/c garbage collection will take care of it. Close just checks with the user and returns true if the file should close.
func (*File) ColorBracketMatch ¶ added in v0.5.0
ColorBracketMatch colorizes a matching bracket character.
func (*File) ComputeIndent ¶ added in v0.3.1
func (file *File) ComputeIndent()
ComputeIndent sets the tabString and tabHealth based on the current indentation.
func (*File) CursorAlign ¶ added in v0.4.2
func (file *File) CursorAlign()
CursorAlign inserts spaces into each cursor position, in order to align the cursors vertically.
func (*File) CursorDown ¶
CursorDown moves the cursor down n rows.
func (*File) CursorGoTo ¶
CursorGoTo moves the cursor to a row, col position. If row is negative, then it specifies from the end of the file.
func (*File) CursorLeft ¶
func (file *File) CursorLeft()
CursorLeft moves the cursor one column to the left.
func (*File) CursorRight ¶
func (file *File) CursorRight()
CursorRight moves the cursor one column to the right.
func (*File) CursorUnalign ¶ added in v0.4.2
func (file *File) CursorUnalign()
CursorUnalign removes whitespace (except for 1 space) immediately preceding each cursor position. Effectively, it undoes a CursorAlign.
func (*File) CutToEndOfLine ¶ added in v0.4.1
func (file *File) CutToEndOfLine()
CutToEndOfLine cuts the text from the cursor to the end of the line.
func (*File) CutToStartOfLine ¶ added in v0.4.1
func (file *File) CutToStartOfLine()
CutToStartOfLine cuts the text from the cursor to the start of the line.
func (*File) EndOfLine ¶
func (file *File) EndOfLine()
EndOfLine moves the cursors to the end of the line.
func (*File) FileChanged ¶ added in v0.5.0
FileChanged checks to see if underlying file changed.
func (*File) Fmt ¶ added in v0.5.0
Fmt runs a code formatter on the text buffer and updates the buffer. For Go code, this calls the go format library. For all else, it runs an external command. If 'selection' is specified, then formatting is done only on selected lines.
func (*File) ForceSnapshot ¶ added in v0.3.3
func (file *File) ForceSnapshot()
ForceSnapshot saves a snapshot of the buffer state, even if it hasn't changed since the last snapshot.
func (*File) GetCursor ¶
GetCursor returns the row, col position for the specified multi-cursor index.
func (*File) InsertChar ¶
InsertChar insters a character (rune) into the current cursor position.
func (*File) IsModified ¶
IsModified checks to see if a file has been modified.
func (*File) MarkedSearch ¶ added in v0.3.3
MarkedSearch searches for searchTerm in the text limited by the muticursor extent.
func (*File) NotifyUser ¶ added in v0.3.1
NotifyUser displays a message to the user.
func (*File) PageDown ¶ added in v0.3.1
func (file *File) PageDown()
PageDown moves the cursor half a screen down.
func (*File) PageUp ¶ added in v0.3.1
func (file *File) PageUp()
PageUp moves the cursor have a screen up.
func (*File) PrevWord ¶
func (file *File) PrevWord()
PrevWord moves the cursor to the previous word.
func (*File) Redo ¶
func (file *File) Redo()
Redo sets the buffer state ahead one in the buffer history.
func (*File) RedoSaved ¶ added in v0.3.4
func (file *File) RedoSaved()
RedoSaved is like UndoSaved, but the other direction in time.
func (*File) RequestFlush ¶ added in v0.3.1
func (file *File) RequestFlush()
RequestFlush places a flush request on the flush channel.
func (*File) RequestSave ¶ added in v0.3.1
func (file *File) RequestSave()
RequestSave places a save request on the save channel.
func (*File) ScrollLeft ¶
func (file *File) ScrollLeft()
ScrollLeft shifts the view screen to the left.
func (*File) ScrollRight ¶
func (file *File) ScrollRight()
ScrollRight shifts the view screen to the right.
func (*File) SearchFromCursor ¶ added in v0.3.3
SearchFromCursor searches the current buffer, starting from the cursor position.
func (*File) SearchFromStart ¶ added in v0.3.3
SearchFromStart searches the buffer from the start of the file.
func (*File) SearchLineBa ¶ added in v0.4.2
SearchLineBa searches backward (to the left) on each marked line. It sets a cursor on each line where a match was found.
func (*File) SearchLineFo ¶ added in v0.4.2
SearchLineFo searches forward (to the right) on each multicursor marked line. It sets a cursor on each line where a match was found.
func (*File) SetCompleter ¶ added in v0.7.0
func (*File) SetLineLen ¶ added in v0.7.0
func (file *File) SetLineLen()
func (*File) SetTabStr ¶ added in v0.4.4
func (file *File) SetTabStr()
SetTabStr manually sets the tab string, and disables auto-tab-detection.
func (*File) SetTabWidth ¶ added in v0.6.0
func (file *File) SetTabWidth()
SetTabWidth sets the tab display width.
func (*File) Snapshot ¶
func (file *File) Snapshot()
Snapshot saves a snapshot of the buffer state, but only if it has changed.
func (*File) SnapshotSaved ¶ added in v0.3.4
func (file *File) SnapshotSaved()
SnapshotSaved saves a special "saved" snapshot when the user saves (or opens) a file.
func (*File) StartOfLine ¶
func (file *File) StartOfLine()
StartOfLine moves the cursors to the start of the line. If they are already at the start, the moves them to the first non-whitespace character.
func (*File) ToCorpus ¶ added in v0.7.0
ToCorpus returns a string representation of the text buffer, with the current token removed. It is used for autocomplete.
func (*File) ToString ¶ added in v0.4.1
ToString returns a string representation of the text buffer. It uses the original newline (from the input file) as the line separator.
func (*File) ToggleAutoFmt ¶ added in v0.5.0
func (file *File) ToggleAutoFmt()
ToggleAutoFmt toggles the auto-format setting.
func (*File) ToggleAutoIndent ¶
func (file *File) ToggleAutoIndent()
ToggleAutoIndent toggles the autoindent setting.
func (*File) ToggleAutoTab ¶ added in v0.3.1
func (file *File) ToggleAutoTab()
ToggleAutoTab toggles the autotab setting.
func (*File) ToggleMCMode ¶ added in v0.6.1
func (file *File) ToggleMCMode()
ToggleMCMode cycles among the available multicursor navigation modes.
func (*File) UndoSaved ¶ added in v0.3.4
func (file *File) UndoSaved()
UndoSaved reverts the buffer state to the last *saved* snapshot.
func (*File) UnsetTabStr ¶ added in v0.4.4
func (file *File) UnsetTabStr()
UnsetTabStr (re)enables auto-tab detaction.
func (*File) WriteStatus ¶
WriteStatus writes the status line.