Documentation
¶
Index ¶
- Constants
- Variables
- func NewQuitGuard(bufferSets *buffer.BufferSets) gecore.QuitGuardResolver
- type BoundariesArray
- func (b *BoundariesArray) BoundariesLen(rowIndex int) int
- func (b *BoundariesArray) Boundary(rowIndex, logicalRowIndex int) *Boundary
- func (b *BoundariesArray) Clear(rowIndex int)
- func (b *BoundariesArray) ClearAll()
- func (b *BoundariesArray) CursorPositionOnScreenLogicalRow(rowIndex, colIndex int) (lx, ly int)
- func (b *BoundariesArray) Delete(rowIndex, count int) error
- func (b *BoundariesArray) GetHangingIndentWidth(rowIndex int) int
- func (b *BoundariesArray) GetIndexOfLogicalRow(rowIndex, colIndex int) int
- func (b *BoundariesArray) Insert(rowIndex, count int)
- func (b *BoundariesArray) IsEndOfLogicalRow(rowIndex, colIndex int) bool
- func (b *BoundariesArray) LastBoundary(rowIndex int) *Boundary
- func (b *BoundariesArray) Len() int
- func (b *BoundariesArray) NeedsReparse(rowIndex int) bool
- func (b *BoundariesArray) OnEndOfLogicalRow(rowIndex, colIndex int) bool
- func (b *BoundariesArray) Set(rowIndex int, boundaries []Boundary, hangingIndentWidth int, ...)
- type Boundary
- type EditorKeymapBinder
- type Editorleaf
- func (e *Editorleaf) Active(a bool)
- func (e *Editorleaf) Autoindent()
- func (e Editorleaf) BackwardKillLine()
- func (e *Editorleaf) ChangeFilePath(path string)
- func (e *Editorleaf) CharInfo()
- func (e *Editorleaf) CommandPalette(s string)
- func (e *Editorleaf) CopyRegion()
- func (e *Editorleaf) DeleteRune()
- func (e *Editorleaf) DeleteRuneBackward()
- func (e *Editorleaf) DispatchKey(ev tcell.EventKey) (string, keychord.KeyDispatchTransition)
- func (e *Editorleaf) Draw()
- func (e *Editorleaf) FilterByCharacters(chars string) []*mark.Mark
- func (e *Editorleaf) GetBuffers() *buffer.BufferSets
- func (e *Editorleaf) GetBuffersFilterByCharacters(chars string) *buffer.BufferSets
- func (e *Editorleaf) GetBytes() []byte
- func (e *Editorleaf) GetPath() string
- func (e *Editorleaf) GetString() string
- func (e *Editorleaf) Init()
- func (e *Editorleaf) InsertRune(ch rune)
- func (e *Editorleaf) InsertString(s string)
- func (e *Editorleaf) InsertTab()
- func (e *Editorleaf) IsActive() bool
- func (e *Editorleaf) IsDirtyFlag() bool
- func (e Editorleaf) IsEndOfLine() bool
- func (e *Editorleaf) IsRedoEmpty() bool
- func (e *Editorleaf) Kill(leaf tree.Leaf, isActive bool) tree.Leaf
- func (e *Editorleaf) KillLine()
- func (e *Editorleaf) KillRegion()
- func (e *Editorleaf) LeafType() tree.LeafType
- func (e *Editorleaf) MinibufferMode(mode Mode)
- func (e *Editorleaf) MoveCursorBackward()
- func (e *Editorleaf) MoveCursorBeginningOfFile()
- func (e *Editorleaf) MoveCursorBeginningOfLine()
- func (e *Editorleaf) MoveCursorBeginningOfLogicalLine()
- func (e *Editorleaf) MoveCursorEndOfFile()
- func (e *Editorleaf) MoveCursorEndOfLine()
- func (e *Editorleaf) MoveCursorEndOfLogicalLine()
- func (e *Editorleaf) MoveCursorForward()
- func (e *Editorleaf) MoveCursorNextLine()
- func (e *Editorleaf) MoveCursorNextWord()
- func (e *Editorleaf) MoveCursorPrevLine()
- func (e *Editorleaf) MoveCursorPreviousWord()
- func (e *Editorleaf) MoveCursorToLine(lineNumber int)
- func (e *Editorleaf) MoveNextFoundWord()
- func (e *Editorleaf) MovePrevFoundWord()
- func (e *Editorleaf) MoveViewHalfBackward()
- func (e *Editorleaf) MoveViewHalfForward()
- func (e *Editorleaf) OpenFile(path string) (editbuffer.Result, error)
- func (e *Editorleaf) Recenter()
- func (e *Editorleaf) Redo()
- func (e *Editorleaf) ReplaceCurrentSearchString(str string)
- func (e *Editorleaf) Resize(viewArea utils.Rect)
- func (e *Editorleaf) Resume()
- func (e *Editorleaf) RowsLength() int
- func (e *Editorleaf) RuneStatus(ch rune) string
- func (e *Editorleaf) SaveFile()
- func (e *Editorleaf) SearchRegexp(searchTerm string, caseSensitive bool, ctx context.Context)
- func (e *Editorleaf) SearchText(text string, caseSensitive, isRegexp bool, ctx context.Context)
- func (e *Editorleaf) SetCurrentMark(m *mark.Mark)
- func (e *Editorleaf) SetCursor(c editbuffer.Cursor)
- func (e *Editorleaf) SetKeyDispatcher(km *keychord.RootNode)
- func (e *Editorleaf) SetMarkAtCursor()
- func (e Editorleaf) SetRows(r [][]byte)
- func (e *Editorleaf) SwapCursorAndMark()
- func (e *Editorleaf) Undo()
- func (e *Editorleaf) WillClose()
- func (e *Editorleaf) Yank()
- func (e *Editorleaf) YankFromClipboard()
- type LeafType
- type MinibufferManagerStruct
- func (m *MinibufferManagerStruct) Active(b bool)
- func (m *MinibufferManagerStruct) Cancel()
- func (m *MinibufferManagerStruct) Close()
- func (m *MinibufferManagerStruct) Dispatch(ev tcell.EventKey) keychord.KeyDispatchTransition
- func (m *MinibufferManagerStruct) Draw(s tcell.Screen)
- func (m *MinibufferManagerStruct) Editor() *Editorleaf
- func (m *MinibufferManagerStruct) GetBytes() []byte
- func (m *MinibufferManagerStruct) GetString() string
- func (m *MinibufferManagerStruct) IsActive() bool
- func (m *MinibufferManagerStruct) MinibufferResize(overlayRect utils.Rect) int
- func (m *MinibufferManagerStruct) Priority() int
- func (m *MinibufferManagerStruct) RequiredHeight() int
- func (m *MinibufferManagerStruct) Resize(overlayRect utils.Rect)
- func (m *MinibufferManagerStruct) SetBytes(content []byte)
- func (m *MinibufferManagerStruct) SetPrompt(prompt string)
- func (m *MinibufferManagerStruct) SetString(content string)
- func (m *MinibufferManagerStruct) Start(session *Session, onComplete func(result keychord.KeyDispatchTransition))
- func (m *MinibufferManagerStruct) UniversalCancel()
- type Mode
- type RowLayout
- type Session
Constants ¶
const ( INSERT syncType = iota DELETE )
Variables ¶
var ( // Initialization has been moved to the newEditor function // BufferSets, _ = buffer.NewBufferSets(gecore.Files) BufferSets *buffer.BufferSets Marks = mark.NewMarks() )
Functions ¶
func NewQuitGuard ¶
func NewQuitGuard(bufferSets *buffer.BufferSets) gecore.QuitGuardResolver
Types ¶
type BoundariesArray ¶
type BoundariesArray struct {
// contains filtered or unexported fields
}
BoundariesArray manages layout cache information per physical row.
It lazily computes wrapping information when needed and stores per-row layout metadata.
func NewBoundariesArray ¶
func NewBoundariesArray(editor *Editorleaf) BoundariesArray
NewBoundariesArray creates a new BoundariesArray.
func (*BoundariesArray) BoundariesLen ¶
func (b *BoundariesArray) BoundariesLen(rowIndex int) int
BoundariesLen returns the number of logical rows (wrapped segments) for the specified physical row.
func (*BoundariesArray) Boundary ¶
func (b *BoundariesArray) Boundary(rowIndex, logicalRowIndex int) *Boundary
Boundary returns the Boundary for the specified row and logical row index.
func (*BoundariesArray) Clear ¶
func (b *BoundariesArray) Clear(rowIndex int)
func (*BoundariesArray) ClearAll ¶
func (b *BoundariesArray) ClearAll()
ClearAll clears all cached layout information.
func (*BoundariesArray) CursorPositionOnScreenLogicalRow ¶ added in v0.1.3
func (b *BoundariesArray) CursorPositionOnScreenLogicalRow(rowIndex, colIndex int) (lx, ly int)
Returns the screen position of the cursor corresponding from cached array to the specified column index in logical rows.
func (*BoundariesArray) Delete ¶
func (b *BoundariesArray) Delete(rowIndex, count int) error
Delete removes count rows starting from rowIndex.
func (*BoundariesArray) GetHangingIndentWidth ¶
func (b *BoundariesArray) GetHangingIndentWidth(rowIndex int) int
GetHangingIndentWidth returns the hanging indentation width for the specified row. It returns 0 if the row is out of range.
func (*BoundariesArray) GetIndexOfLogicalRow ¶ added in v0.1.3
func (b *BoundariesArray) GetIndexOfLogicalRow(rowIndex, colIndex int) int
func (*BoundariesArray) Insert ¶
func (b *BoundariesArray) Insert(rowIndex, count int)
Insert inserts count empty rows at rowIndex.
func (*BoundariesArray) IsEndOfLogicalRow ¶ added in v0.1.3
func (b *BoundariesArray) IsEndOfLogicalRow(rowIndex, colIndex int) bool
func (*BoundariesArray) LastBoundary ¶
func (b *BoundariesArray) LastBoundary(rowIndex int) *Boundary
LastBoundary returns the last logical row boundary for the specified physical row.
func (*BoundariesArray) Len ¶
func (b *BoundariesArray) Len() int
Len returns the number of rows currently stored.
func (*BoundariesArray) NeedsReparse ¶ added in v0.1.3
func (b *BoundariesArray) NeedsReparse(rowIndex int) bool
NeedsReparse reports whether layout information for rowIndex needs to be recomputed.
func (*BoundariesArray) OnEndOfLogicalRow ¶ added in v0.1.3
func (b *BoundariesArray) OnEndOfLogicalRow(rowIndex, colIndex int) bool
Check if the column index is within the last boundary of the specified row Return false: out of index or not initialized.
type Boundary ¶
type Boundary struct {
// StartLogicalRowByteIndex is the inclusive start byte index
// within the original row.
StartLogicalRowByteIndex int
// StopLogicalRowByteIndex is the exclusive end byte index
// within the original row.
StopLogicalRowByteIndex int
// LogicalRowWidth is the rendered width (in cells)
// of this logical row.
LogicalRowWidth int
// TotalCellWidth includes tab expansion width.
TotalCellWidth int
}
Boundary represents a single wrapped logical row segment within a physical line.
A physical line (row) may be split into multiple logical rows due to wrapping. Each Boundary describes one such segment.
type EditorKeymapBinder ¶
type EditorKeymapBinder func(root *keychord.RootNode, editor *Editorleaf)
type Editorleaf ¶
type Editorleaf struct {
// contains filtered or unexported fields
}
Editorleaf Struct implements the gecore.tree.Leaf interface
func NewMinibufferLeaf ¶
func NewMinibufferLeaf() *Editorleaf
MinibufferLeaf は tree に属さない Editor が生成されたタイミングで keymap をバインドしない
func (*Editorleaf) Active ¶
func (e *Editorleaf) Active(a bool)
func (*Editorleaf) Autoindent ¶
func (e *Editorleaf) Autoindent()
func (Editorleaf) BackwardKillLine ¶
func (e Editorleaf) BackwardKillLine()
unix-line-discard backward-kill-line
func (*Editorleaf) ChangeFilePath ¶
func (e *Editorleaf) ChangeFilePath(path string)
If an existing file is specified, it will be overwritten Backup works so no data is lost, but...
func (*Editorleaf) CharInfo ¶
func (e *Editorleaf) CharInfo()
func (*Editorleaf) CommandPalette ¶
func (e *Editorleaf) CommandPalette(s string)
func (*Editorleaf) CopyRegion ¶
func (e *Editorleaf) CopyRegion()
Copy cursor region to Kill Buffer and Clipboard
func (*Editorleaf) DeleteRune ¶
func (e *Editorleaf) DeleteRune()
If at the EOL, move contents of the next line to the end of the current line, erasing the next line after that. Otherwise, delete one character under the cursor.
func (*Editorleaf) DeleteRuneBackward ¶
func (e *Editorleaf) DeleteRuneBackward()
func (*Editorleaf) DispatchKey ¶
func (e *Editorleaf) DispatchKey(ev tcell.EventKey) (string, keychord.KeyDispatchTransition)
func (*Editorleaf) Draw ¶
func (e *Editorleaf) Draw()
func (*Editorleaf) FilterByCharacters ¶
func (e *Editorleaf) FilterByCharacters(chars string) []*mark.Mark
func (*Editorleaf) GetBuffers ¶
func (e *Editorleaf) GetBuffers() *buffer.BufferSets
func (*Editorleaf) GetBuffersFilterByCharacters ¶
func (e *Editorleaf) GetBuffersFilterByCharacters(chars string) *buffer.BufferSets
func (*Editorleaf) GetBytes ¶
func (e *Editorleaf) GetBytes() []byte
編集中のテキストの []byte を返す editorleaf.editbuffer.RowsStruct.Bytes() のラッパー
func (*Editorleaf) GetPath ¶
func (e *Editorleaf) GetPath() string
func (*Editorleaf) GetString ¶
func (e *Editorleaf) GetString() string
func (*Editorleaf) Init ¶
func (e *Editorleaf) Init()
func (*Editorleaf) InsertString ¶
func (e *Editorleaf) InsertString(s string)
Wrapper is insertBytes
func (*Editorleaf) InsertTab ¶
func (e *Editorleaf) InsertTab()
func (*Editorleaf) IsActive ¶
func (e *Editorleaf) IsActive() bool
func (*Editorleaf) IsDirtyFlag ¶
func (e *Editorleaf) IsDirtyFlag() bool
func (Editorleaf) IsEndOfLine ¶
func (e Editorleaf) IsEndOfLine() bool
func (*Editorleaf) IsRedoEmpty ¶
func (e *Editorleaf) IsRedoEmpty() bool
func (*Editorleaf) KillLine ¶
func (e *Editorleaf) KillLine()
Kill line: If not at the EOL, remove contents of the current line from the cursor to the end. Otherwise behave like 'delete'. 行を削除します: EOL でない場合は、カーソルから末尾までの現在の行の内容を削除します。 それ以外の場合は、「delete」のように動作します。
func (*Editorleaf) KillRegion ¶
func (e *Editorleaf) KillRegion()
Kill region between last mark to cursor and push undo and kill buffers
func (*Editorleaf) LeafType ¶
func (e *Editorleaf) LeafType() tree.LeafType
func (*Editorleaf) MinibufferMode ¶
func (e *Editorleaf) MinibufferMode(mode Mode)
func (*Editorleaf) MoveCursorBackward ¶
func (e *Editorleaf) MoveCursorBackward()
Move cursor one character backward.
func (*Editorleaf) MoveCursorBeginningOfFile ¶
func (e *Editorleaf) MoveCursorBeginningOfFile()
func (*Editorleaf) MoveCursorBeginningOfLine ¶
func (e *Editorleaf) MoveCursorBeginningOfLine()
Move cursor to the beginning of the line. Consider indentation
func (*Editorleaf) MoveCursorBeginningOfLogicalLine ¶
func (e *Editorleaf) MoveCursorBeginningOfLogicalLine()
Move cursor to the beginning of the logical row. Consider logical row Consider indentation....
func (*Editorleaf) MoveCursorEndOfFile ¶
func (e *Editorleaf) MoveCursorEndOfFile()
func (*Editorleaf) MoveCursorEndOfLine ¶
func (e *Editorleaf) MoveCursorEndOfLine()
Move cursor to the end of the line.
func (*Editorleaf) MoveCursorEndOfLogicalLine ¶
func (e *Editorleaf) MoveCursorEndOfLogicalLine()
Move cursor to the end of logical the line. At the end of a logical line, the cursor should at the beginning of the next logical line. so I see...
func (*Editorleaf) MoveCursorForward ¶
func (e *Editorleaf) MoveCursorForward()
Move cursor one character forward.
func (*Editorleaf) MoveCursorNextLine ¶
func (e *Editorleaf) MoveCursorNextLine()
Move cursor to the next line.
func (*Editorleaf) MoveCursorNextWord ¶
func (e *Editorleaf) MoveCursorNextWord()
Move cursor to next word.
func (*Editorleaf) MoveCursorPrevLine ¶
func (e *Editorleaf) MoveCursorPrevLine()
Move cursor to the previous line.
func (*Editorleaf) MoveCursorPreviousWord ¶
func (e *Editorleaf) MoveCursorPreviousWord()
func (*Editorleaf) MoveCursorToLine ¶
func (e *Editorleaf) MoveCursorToLine(lineNumber int)
func (*Editorleaf) MoveNextFoundWord ¶
func (e *Editorleaf) MoveNextFoundWord()
func (*Editorleaf) MovePrevFoundWord ¶
func (e *Editorleaf) MovePrevFoundWord()
func (*Editorleaf) MoveViewHalfBackward ¶
func (e *Editorleaf) MoveViewHalfBackward()
Move view 'n' lines forward or backward.
func (*Editorleaf) MoveViewHalfForward ¶
func (e *Editorleaf) MoveViewHalfForward()
Move view 'n' lines forward or backward only if it's possible.
func (*Editorleaf) OpenFile ¶
func (e *Editorleaf) OpenFile(path string) (editbuffer.Result, error)
If the file has already been read, use that buffer
func (*Editorleaf) Recenter ¶
func (e *Editorleaf) Recenter()
func (*Editorleaf) Redo ¶
func (e *Editorleaf) Redo()
func (*Editorleaf) ReplaceCurrentSearchString ¶
func (e *Editorleaf) ReplaceCurrentSearchString(str string)
func (*Editorleaf) Resize ¶
func (e *Editorleaf) Resize(viewArea utils.Rect)
func (*Editorleaf) Resume ¶
func (e *Editorleaf) Resume()
func (*Editorleaf) RowsLength ¶
func (e *Editorleaf) RowsLength() int
func (*Editorleaf) RuneStatus ¶
func (e *Editorleaf) RuneStatus(ch rune) string
Convert rune to displaying string on mode line Conversion target:
- control code: ^X
- newline code
Line feed code is depending the editing buffer newline
func (*Editorleaf) SaveFile ¶
func (e *Editorleaf) SaveFile()
If the file does not exist, a backup error will occur
func (*Editorleaf) SearchRegexp ¶
func (e *Editorleaf) SearchRegexp(searchTerm string, caseSensitive bool, ctx context.Context)
func (*Editorleaf) SearchText ¶
func (e *Editorleaf) SearchText(text string, caseSensitive, isRegexp bool, ctx context.Context)
When not using regular expressions
func (*Editorleaf) SetCurrentMark ¶
func (e *Editorleaf) SetCurrentMark(m *mark.Mark)
func (*Editorleaf) SetCursor ¶
func (e *Editorleaf) SetCursor(c editbuffer.Cursor)
func (*Editorleaf) SetKeyDispatcher ¶
func (e *Editorleaf) SetKeyDispatcher(km *keychord.RootNode)
func (*Editorleaf) SetMarkAtCursor ¶
func (e *Editorleaf) SetMarkAtCursor()
func (Editorleaf) SetRows ¶
func (e Editorleaf) SetRows(r [][]byte)
func (*Editorleaf) SwapCursorAndMark ¶
func (e *Editorleaf) SwapCursorAndMark()
func (*Editorleaf) Undo ¶
func (e *Editorleaf) Undo()
func (*Editorleaf) WillClose ¶
func (e *Editorleaf) WillClose()
func (*Editorleaf) Yank ¶
func (e *Editorleaf) Yank()
func (*Editorleaf) YankFromClipboard ¶
func (e *Editorleaf) YankFromClipboard()
type LeafType ¶
type LeafType struct {
// contains filtered or unexported fields
}
Implements LeafType interface
func NewLeafType ¶
func NewLeafType(bind EditorKeymapBinder) *LeafType
type MinibufferManagerStruct ¶
type MinibufferManagerStruct struct {
// contains filtered or unexported fields
}
Required implement Overlay interface
func MinibufferManager ¶
func MinibufferManager() *MinibufferManagerStruct
func (*MinibufferManagerStruct) Active ¶
func (m *MinibufferManagerStruct) Active(b bool)
func (*MinibufferManagerStruct) Cancel ¶
func (m *MinibufferManagerStruct) Cancel()
func (*MinibufferManagerStruct) Close ¶
func (m *MinibufferManagerStruct) Close()
func (*MinibufferManagerStruct) Dispatch ¶
func (m *MinibufferManagerStruct) Dispatch(ev tcell.EventKey) keychord.KeyDispatchTransition
func (*MinibufferManagerStruct) Draw ¶
func (m *MinibufferManagerStruct) Draw(s tcell.Screen)
func (*MinibufferManagerStruct) Editor ¶
func (m *MinibufferManagerStruct) Editor() *Editorleaf
func (*MinibufferManagerStruct) GetBytes ¶
func (m *MinibufferManagerStruct) GetBytes() []byte
Return input content
func (*MinibufferManagerStruct) GetString ¶
func (m *MinibufferManagerStruct) GetString() string
Return input content
func (*MinibufferManagerStruct) IsActive ¶
func (m *MinibufferManagerStruct) IsActive() bool
func (*MinibufferManagerStruct) MinibufferResize ¶
func (m *MinibufferManagerStruct) MinibufferResize(overlayRect utils.Rect) int
return Remaining height overlayRect.Height: この値のみ画面の高さ
func (*MinibufferManagerStruct) Priority ¶
func (m *MinibufferManagerStruct) Priority() int
func (*MinibufferManagerStruct) RequiredHeight ¶
func (m *MinibufferManagerStruct) RequiredHeight() int
return minibuffer height
func (*MinibufferManagerStruct) Resize ¶
func (m *MinibufferManagerStruct) Resize(overlayRect utils.Rect)
func (*MinibufferManagerStruct) SetBytes ¶
func (m *MinibufferManagerStruct) SetBytes(content []byte)
func (*MinibufferManagerStruct) SetPrompt ¶
func (m *MinibufferManagerStruct) SetPrompt(prompt string)
func (*MinibufferManagerStruct) SetString ¶
func (m *MinibufferManagerStruct) SetString(content string)
func (*MinibufferManagerStruct) Start ¶
func (m *MinibufferManagerStruct) Start(session *Session, onComplete func(result keychord.KeyDispatchTransition))
func (*MinibufferManagerStruct) UniversalCancel ¶
func (m *MinibufferManagerStruct) UniversalCancel()
type RowLayout ¶
type RowLayout struct {
// Boundaries contains all wrapped logical row segments.
Boundaries []Boundary
// HangingIndentWidth is the indentation width applied to
// wrapped logical rows after the first one.
HangingIndentWidth int
RuneWidthCache []locale.Cell
}
RowLayout represents layout information for a single physical row.
It contains all computed wrapping boundaries and additional layout metadata such as hanging indentation width.