Documentation
¶
Index ¶
- Constants
- type BufRender
- type Buffer
- func (b *Buffer) Delete()
- func (b *Buffer) DeleteLine()
- func (b *Buffer) Insert(data rune)
- func (b *Buffer) InsertString(s string)
- func (b *Buffer) InsertTab()
- func (b *Buffer) New(path string, log *log.Logger) FileOpenState
- func (b *Buffer) NewLine()
- func (b *Buffer) ResetHightlight()
- func (b *Buffer) Save(path string) (int, error)
- type Editor
- type FileOpMode
- type FileOpenState
- type KeyMapper
- type KeyOps
- type Mode
- type Pos
- type Render
- func (r *Render) Clear()
- func (r *Render) Draw(content RenderContent)
- func (r *Render) Init(sett *Setting, logger *log.Logger)
- func (r *Render) IsMousePointerOnBuffer(mousePos Pos) bool
- func (r *Render) IsMousePointerOnBufferName(mousePos Pos, filePath string, bufIdx int) bool
- func (r *Render) MoveCursor(mode Mode, buf *Buffer, op KeyOps)
- func (r *Render) MoveCursorByMouse(buf *Buffer, p Pos, mode Mode)
- type RenderContent
- type Search
- type Setting
Constants ¶
const ( VERSION = "0.2.6 alpha" TABWIDTH = 4 )
const ( DEFAULT_BUFFERNAME = "untitled" DEFAULT_CURR_BUF_INDEX = 0 HELP_DOC_PATH = "/usr/local/share/doc/pe/help.txt" )
const ( HEADLINE_OFFSET = 0 STATUSLINE_OFFSET = -1 BUFFER_CONTENT_START_OFFSET = 1 BUFFER_DIR_CONTENT_START_OFFSET = 2 BUFFER_END_OFFSET = -2 )
UI
const ( FileOpenInfo = "Open file (^G to cancel): " FileSaveInfo = "Save file (^G to cancel): " SearchInfo = "Search (^G to cancel): " )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufRender ¶
type BufRender struct {
// contains filtered or unexported fields
}
BufRender renders content of a buffer ViewStartPos and ViewEndPos are the absolute coordinate of the view on terminal screen ViewCursor is the absolute coordinate of the cusor ViewAnchor is the coordinate of buffer content, used to calculate content outside of the screen HlStartPos and hlEndPos are the view coordinate of the highlight area
func (*BufRender) MoveCursorByMouse ¶
* Mouse position is limited by terminal height and weight * It should be one to one mapped to view cursor position * But there are multi-length rune that we cannot position cursor * in between. So we convert back to cursor first. *
func (*BufRender) SyncCursorToView ¶
Calculate cursor colume position Cursor buffer position is different than terminal view since runes can have multiple width
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func (*Buffer) DeleteLine ¶
func (b *Buffer) DeleteLine()
func (*Buffer) InsertString ¶
func (*Buffer) ResetHightlight ¶
func (b *Buffer) ResetHightlight()
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
type FileOpenState ¶
type FileOpenState int64
const ( Success FileOpenState = iota IsDir HasError NotFound )
type KeyOps ¶
type KeyOps int64
const ( NoOp KeyOps = iota // Editor Ops ExitOp OpenFileOp SaveFileOp CloseFileOp HelpOp NextBufferOp PrevBufferOp // Navigation Ops MoveCursorUpOp MoveCursorDownOp MoveCursorLeftOp MoveCursorRightOp NextHalfPageOp PrevHalfPageOp // of the line GoToBOLOp GoToEOLOp // of the document GoToBODOp GoToEODOp // Text Edit Ops InsertChOp InsertSpaceOp InsertTabOp InsertEnterOp DeleteChOp DeleteLineOp // Search SearchOp SearchNextOp SearchPrevOp // Misc CmdOp CancelOp )
type Render ¶
type Render struct {
// contains filtered or unexported fields
}
func (*Render) Draw ¶
func (r *Render) Draw(content RenderContent)
func (*Render) IsMousePointerOnBuffer ¶
func (*Render) IsMousePointerOnBufferName ¶
type RenderContent ¶
type RenderContent struct {
// contains filtered or unexported fields
}
type Search ¶
type Search struct {
// contains filtered or unexported fields
}