rwedit

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoIndent

func AutoIndent(ctx *Ctx) error

func Backspace

func Backspace(ctx *Ctx) error

func Comment

func Comment(ctx *Ctx) error

func Copy

func Copy(ctx *Ctx) error

func Cut

func Cut(ctx *Ctx) error

func Delete

func Delete(ctx *Ctx) error

func DuplicateLines

func DuplicateLines(ctx *Ctx) error

func EndOfLine

func EndOfLine(ctx *Ctx, sel bool) error

func EndOfString

func EndOfString(ctx *Ctx, sel bool)

func Find

func Find(cctx context.Context, ctx *Ctx, str string) (bool, error)

func HandleInput

func HandleInput(ctx *Ctx, ev interface{}) (event.Handled, error)

func InsertString

func InsertString(ctx *Ctx, s string) error

func MoveCursorDown

func MoveCursorDown(ctx *Ctx, sel bool)

func MoveCursorJumpLeft

func MoveCursorJumpLeft(ctx *Ctx, sel bool) error

func MoveCursorJumpRight

func MoveCursorJumpRight(ctx *Ctx, sel bool) error

func MoveCursorLeft

func MoveCursorLeft(ctx *Ctx, sel bool) error

func MoveCursorRight

func MoveCursorRight(ctx *Ctx, sel bool) error

func MoveCursorToPoint

func MoveCursorToPoint(ctx *Ctx, p image.Point, sel bool)

func MoveCursorUp

func MoveCursorUp(ctx *Ctx, sel bool)

func MoveLineDown

func MoveLineDown(ctx *Ctx) error

func MoveLineUp

func MoveLineUp(ctx *Ctx) error

func PageUp

func PageUp(ctx *Ctx, up bool)

func Paste

func Paste(ctx *Ctx, ci event.ClipboardIndex)

func Redo

func Redo(ctx *Ctx) error

func RemoveLines

func RemoveLines(ctx *Ctx) error

func Replace

func Replace(ctx *Ctx, old, new string) (bool, error)

func ScrollUp

func ScrollUp(ctx *Ctx, up bool)

func SelectAll

func SelectAll(ctx *Ctx) error

func SelectLine

func SelectLine(ctx *Ctx) error

func SelectWord

func SelectWord(ctx *Ctx) error

func StartOfLine

func StartOfLine(ctx *Ctx, sel bool) error

func StartOfString

func StartOfString(ctx *Ctx, sel bool)

func TabLeft

func TabLeft(ctx *Ctx) error

func TabRight

func TabRight(ctx *Ctx) error

func Uncomment

func Uncomment(ctx *Ctx) error

func Undo

func Undo(ctx *Ctx) error

Types

type Ctx

type Ctx struct {
	RW  iorw.ReadWriterAt
	C   Cursor
	Fns CtxFns
}

func NewCtx

func NewCtx() *Ctx

func (*Ctx) CursorSelectionLinesIndexes

func (ctx *Ctx) CursorSelectionLinesIndexes() (int, int, bool, error)

func (*Ctx) LocalReader

func (ctx *Ctx) LocalReader(i int) iorw.ReaderAt

func (*Ctx) LocalReader2

func (ctx *Ctx) LocalReader2(min, max int) iorw.ReaderAt

func (*Ctx) Selection

func (ctx *Ctx) Selection() ([]byte, bool)

type CtxFns

type CtxFns struct {
	Error func(error)

	GetPoint         func(int) image.Point
	GetIndex         func(image.Point) int
	LineHeight       func() int
	LineCommentStr   func() string
	MakeIndexVisible func(int)
	PageUp           func(up bool)
	ScrollUp         func(up bool)

	SetClipboardData func(event.ClipboardIndex, string)
	GetClipboardData func(event.ClipboardIndex, func(string, error)) // setter should wrap fn to run on ui goroutine

	Undo func() error
	Redo func() error
}

func EmptyCtxFns

func EmptyCtxFns() CtxFns

type Cursor

type Cursor interface {
	Set(c SimpleCursor)
	Get() SimpleCursor

	Index() int
	SetIndex(int)
	SelectionIndex() int
	SetSelection(si, ci int)
	SetSelectionOff()
	SetIndexSelectionOff(i int)
	HaveSelection() bool
	UpdateSelection(on bool, ci int)
	SelectionIndexes() (int, int, bool)
	SelectionIndexesUnsorted() (int, int, bool)
}

type Input

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

type SimpleCursor

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

func (*SimpleCursor) Get

func (c *SimpleCursor) Get() SimpleCursor

func (*SimpleCursor) HaveSelection

func (c *SimpleCursor) HaveSelection() bool

func (*SimpleCursor) Index

func (c *SimpleCursor) Index() int

func (*SimpleCursor) SelectionIndex

func (c *SimpleCursor) SelectionIndex() int

func (*SimpleCursor) SelectionIndexes

func (c *SimpleCursor) SelectionIndexes() (int, int, bool)

Values returned are sorted

func (*SimpleCursor) SelectionIndexesUnsorted

func (c *SimpleCursor) SelectionIndexesUnsorted() (int, int, bool)

func (*SimpleCursor) Set

func (c *SimpleCursor) Set(c2 SimpleCursor)

func (*SimpleCursor) SetIndex

func (c *SimpleCursor) SetIndex(i int)

func (*SimpleCursor) SetIndexSelectionOff

func (c *SimpleCursor) SetIndexSelectionOff(i int)

func (*SimpleCursor) SetSelection

func (c *SimpleCursor) SetSelection(si, ci int)

func (*SimpleCursor) SetSelectionOff

func (c *SimpleCursor) SetSelectionOff()

func (*SimpleCursor) UpdateSelection

func (c *SimpleCursor) UpdateSelection(on bool, ci int)

type TriggerCursor

type TriggerCursor struct {
	*SimpleCursor
	// contains filtered or unexported fields
}

func NewTriggerCursor

func NewTriggerCursor(onChange func()) *TriggerCursor

func (*TriggerCursor) Set

func (tc *TriggerCursor) Set(c SimpleCursor)

func (*TriggerCursor) SetIndex

func (tc *TriggerCursor) SetIndex(i int)

func (*TriggerCursor) SetIndexSelectionOff

func (tc *TriggerCursor) SetIndexSelectionOff(i int)

func (*TriggerCursor) SetSelection

func (tc *TriggerCursor) SetSelection(si, ci int)

func (*TriggerCursor) SetSelectionOff

func (tc *TriggerCursor) SetSelectionOff()

func (*TriggerCursor) UpdateSelection

func (tc *TriggerCursor) UpdateSelection(on bool, ci int)

Jump to

Keyboard shortcuts

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