editor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package editor implements an editor widget which can also be used as a pager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CursorEvent

type CursorEvent struct {
	tcell.EventTime
	// contains filtered or unexported fields
}

CursorEvent reports a changed cursor event.

func (*CursorEvent) SetWidget

func (cev *CursorEvent) SetWidget(widget views.Widget)

SetWidget set the views.Widget for the CursorEvent.

func (*CursorEvent) Widget

func (cev *CursorEvent) Widget() views.Widget

Widget returns the views.Widget for the CursorEvent.

type Editor

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

Editor is an editor widget.

func New

func New() *Editor

New creates a blank Editor.

func (*Editor) Draw

func (a *Editor) Draw()

Draw draws the content.

func (*Editor) EnableCursor

func (e *Editor) EnableCursor(on bool)

EnableCursor enables a soft cursor in the Editor.

func (*Editor) GetCursor

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

GetCursor returns the current cursor position.

func (*Editor) HandleEvent

func (a *Editor) HandleEvent(e tcell.Event) bool

HandleEvent handles events. In particular, it handles certain key events to move the cursor or pan the view.

func (*Editor) HideCursor

func (e *Editor) HideCursor(on bool)

HideCursor hides or shows the cursor in the Editor. If on is true, the cursor is hidden. Note that a cursor is only shown if it is enabled.

func (*Editor) Init

func (e *Editor) Init()

Init initializes the Editor.

func (*Editor) MakeCursorVisible

func (a *Editor) MakeCursorVisible()

MakeCursorVisible ensures that the cursor is visible, panning the ViewPort as necessary, if the cursor is enabled.

func (*Editor) MakeVisible

func (a *Editor) MakeVisible(x, y int)

MakeVisible makes the given coordinates visible, if they are not already. It does this by moving the ViewPort for the textBufferView.

func (*Editor) Resize

func (a *Editor) Resize()

Resize is called when the View is resized. It will ensure that the cursor is visible, if present.

func (*Editor) SetContent

func (e *Editor) SetContent(b []byte)

SetContent of Editor.

func (*Editor) SetCursor

func (a *Editor) SetCursor(x, y int)

SetCursor sets the the cursor position.

func (*Editor) SetCursorX

func (a *Editor) SetCursorX(x int)

SetCursorX sets the the cursor column.

func (*Editor) SetCursorY

func (a *Editor) SetCursorY(y int)

SetCursorY sets the the cursor row.

func (*Editor) SetModel

func (a *Editor) SetModel(model views.CellModel)

SetModel sets the model for this textBufferView.

func (*Editor) SetStyle

func (e *Editor) SetStyle(style tcell.Style)

SetStyle of Editor.

func (*Editor) SetView

func (a *Editor) SetView(view views.View)

SetView sets the View context.

func (*Editor) Size

func (a *Editor) Size() (int, int)

Size returns the content size, based on the model.

Jump to

Keyboard shortcuts

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