editor

package
v0.0.0-...-2ab8766 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigWrapLeft  = true // Allow wrapping cursor to the previous line with 'h' motion.
	ConfigWrapRight = true // Allow wrapping cursor to the next line with 'l' motion.
)

Variables

View Source
var ErrQuit = errors.New("quit")

Functions

This section is empty.

Types

type Command

type Command interface {
	Apply(*Editor)
}

type Editor

type Editor struct {
	LastSearchTerm string

	// Event channels
	UIEvents chan termbox.Event
	Commands chan Command
	// contains filtered or unexported fields
}

func NewEditor

func NewEditor(filenames []string) *Editor

func (*Editor) ActiveView

func (e *Editor) ActiveView() *view.View

func (*Editor) ActiveViewNode

func (e *Editor) ActiveViewNode() *view.Tree

func (*Editor) CursorPosition

func (e *Editor) CursorPosition() (int, int)

cursorPosition returns the absolute screen coordinates of the cursor

func (*Editor) Draw

func (e *Editor) Draw()

func (*Editor) DrawStatus

func (e *Editor) DrawStatus(text []byte)

func (*Editor) Height

func (e *Editor) Height() int

func (*Editor) Loop

func (e *Editor) Loop() error

Loops starts the editor main loop

func (*Editor) NewBufferFromFile

func (e *Editor) NewBufferFromFile(filename string) (*buffer.Buffer, error)

func (*Editor) Quit

func (e *Editor) Quit()

func (*Editor) Resize

func (e *Editor) Resize()

Call it manually only when views layout has changed.

func (*Editor) SetActiveViewNode

func (e *Editor) SetActiveViewNode(node *view.Tree)

func (*Editor) SetMode

func (e *Editor) SetMode(m Mode)

SetMode sets active editor mode. The specified mode instance will react to keys and other user input until another mode is set.

func (*Editor) SetStatus

func (e *Editor) SetStatus(format string, args ...interface{})

func (*Editor) SplitHorizontally

func (e *Editor) SplitHorizontally()

func (*Editor) SplitVertically

func (e *Editor) SplitVertically()

type Mode

type Mode interface {
	Enter(e *Editor)
	OnKey(ev *termbox.Event)
	Exit()
}

type Overlay

type Overlay interface {
	NeedsCursor() bool
	CursorPosition() (int, int)
	OnResize(ev *termbox.Event)
	Draw()
}

Jump to

Keyboard shortcuts

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