Documentation
¶
Index ¶
- func InitTree(sourceCode *SourceCode, ext string) tea.Cmd
- type Line
- type Mode
- type Model
- type SourceCode
- func (s *SourceCode) AddSelection()
- func (s *SourceCode) CurrentLine() (int, Line, error)
- func (s *SourceCode) GenerateColors() []byte
- func (s *SourceCode) GenerateTree() *sitter.Node
- func (s *SourceCode) GetColors(start, end int) []byte
- func (s *SourceCode) GetSelection() (start, end int)
- func (s *SourceCode) GetSlice(start, end int) []byte
- func (s *SourceCode) LineWidth(l Line) int
- func (s *SourceCode) Lines() map[int]Line
- func (s *SourceCode) RegenerateLines()
- func (s *SourceCode) RelalcHpos()
- func (s *SourceCode) SetCursor(pos int)
- func (s *SourceCode) SetSource(source []byte)
- func (s *SourceCode) StartSelection()
- type TreeInitMsg
- type Viewport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line describes a line. Using this I can easily index lines and get their length and indentation
type Model ¶
type Model struct { Path string // Absolute path on disk. Focused bool Mode Mode // Current buffer mode // contains filtered or unexported fields }
Model represents an opened file.
func (*Model) WriteToDisk ¶
WriteToDisk saves the current buffer to disk
type SourceCode ¶
type SourceCode struct {
// contains filtered or unexported fields
}
SourceCode is the main container for the opened files. TODO name to something more generic, like Buffer?
func (*SourceCode) AddSelection ¶
func (s *SourceCode) AddSelection()
func (*SourceCode) CurrentLine ¶
func (s *SourceCode) CurrentLine() (int, Line, error)
CurrentLine returns the current line index and value
func (*SourceCode) GenerateColors ¶
func (s *SourceCode) GenerateColors() []byte
GenerateColors generates the new Syntax Highlighting for the current tree. It is a blocking operation that should take as little as possible.
func (*SourceCode) GenerateTree ¶
func (s *SourceCode) GenerateTree() *sitter.Node
func (*SourceCode) GetColors ¶
func (s *SourceCode) GetColors(start, end int) []byte
func (*SourceCode) GetSelection ¶
func (s *SourceCode) GetSelection() (start, end int)
func (*SourceCode) GetSlice ¶
func (s *SourceCode) GetSlice(start, end int) []byte
GetSlice returns the slice between start and end
func (*SourceCode) LineWidth ¶
func (s *SourceCode) LineWidth(l Line) int
Returns the width, in characters, of a given line
func (*SourceCode) Lines ¶
func (s *SourceCode) Lines() map[int]Line
Returns a map of type lineIndex: {start in buffer, end in buffer}
func (*SourceCode) RegenerateLines ¶
func (s *SourceCode) RegenerateLines()
RegenerateLines regenerates the line information
func (*SourceCode) RelalcHpos ¶
func (s *SourceCode) RelalcHpos()
func (*SourceCode) SetCursor ¶
func (s *SourceCode) SetCursor(pos int)
func (*SourceCode) SetSource ¶
func (s *SourceCode) SetSource(source []byte)
SetSource loads a file and computes the appropriate LineInfo's
func (*SourceCode) StartSelection ¶
func (s *SourceCode) StartSelection()
type TreeInitMsg ¶
type TreeInitMsg struct {
// contains filtered or unexported fields
}
Contains the new cursor coordinates