editor

package
v0.0.0-...-146fef3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteWidth

func ByteWidth(str string, tabSize int) int

func Count

func Count(b []byte) int

func GetCursorVisualX

func GetCursorVisualX(x int, line string) int

Types

type Editor

type Editor struct {
	Views map[string]*View
	// contains filtered or unexported fields
}

func NewEditor

func NewEditor(rw io.ReadWriter, configPath string) *Editor

func (*Editor) CloseView

func (e *Editor) CloseView(v *View)

func (*Editor) CurView

func (e *Editor) CurView() *View

func (*Editor) Start

func (e *Editor) Start()

type InputHandler

type InputHandler struct {
	ViewID string
	// TODO: Maybe just keep this stuff on View struct
	FilePath string
	// contains filtered or unexported fields
}

func (*InputHandler) DeleteBackward

func (ih *InputHandler) DeleteBackward()

func (*InputHandler) DeleteForward

func (ih *InputHandler) DeleteForward()

func (*InputHandler) Insert

func (ih *InputHandler) Insert(char string)

func (*InputHandler) MoveDown

func (ih *InputHandler) MoveDown()

func (*InputHandler) MoveLeft

func (ih *InputHandler) MoveLeft()

func (*InputHandler) MoveRight

func (ih *InputHandler) MoveRight()

func (*InputHandler) MoveUp

func (ih *InputHandler) MoveUp()

func (*InputHandler) MoveWordLeft

func (ih *InputHandler) MoveWordLeft()

func (*InputHandler) MoveWordRight

func (ih *InputHandler) MoveWordRight()

func (*InputHandler) Newline

func (ih *InputHandler) Newline()

func (*InputHandler) Redo

func (ih *InputHandler) Redo()

func (*InputHandler) Save

func (ih *InputHandler) Save()

func (*InputHandler) Tab

func (ih *InputHandler) Tab()

func (*InputHandler) Undo

func (ih *InputHandler) Undo()

type Line

type Line struct {
	Text     string
	Cursors  []int
	Styles   []int
	StyleIds map[int]int
}

func NewLine

func NewLine(text string, cursors []int, styles []int) *Line

func (*Line) SetStyles

func (l *Line) SetStyles(styles []int)

TODO: Implement syntax highlight

type LineCache

type LineCache struct {
	// contains filtered or unexported fields
}

func NewLineCache

func NewLineCache() *LineCache

func (*LineCache) ApplyUpdate

func (lc *LineCache) ApplyUpdate(update *rpc.Update)

type Painter

type Painter interface {
	SetContent(x int, y int, ch rune, comb []rune, style tcell.Style)
	ShowCursor(x int, y int)
	Size() (int, int)
}

type View

type View struct {
	*LineCache
	*InputHandler

	ID string

	ViewID string
	// contains filtered or unexported fields
}

func NewView

func NewView(path string, vp *Viewport, xi *rpc.Connection) (*View, error)

func (*View) Draw

func (v *View) Draw()

func (*View) HandleEvent

func (v *View) HandleEvent(ev tcell.Event)

type Viewport

type Viewport struct {
	// contains filtered or unexported fields
}

func NewViewport

func NewViewport(parent Painter, offx, offy int) *Viewport

func (*Viewport) FillParent

func (v *Viewport) FillParent()

func (*Viewport) SetContent

func (v *Viewport) SetContent(x int, y int, ch rune, comb []rune, style tcell.Style)

func (*Viewport) SetHeight

func (v *Viewport) SetHeight(h int)

func (*Viewport) SetOffsetX

func (v *Viewport) SetOffsetX(x int)

func (*Viewport) SetOffsetY

func (v *Viewport) SetOffsetY(y int)

func (*Viewport) SetWidth

func (v *Viewport) SetWidth(w int)

func (*Viewport) ShowCursor

func (v *Viewport) ShowCursor(x int, y int)

func (*Viewport) Size

func (v *Viewport) Size() (int, int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL