buffer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TabSize = 8

Variables

This section is empty.

Functions

func RuneWidthBackJump added in v0.4.0

func RuneWidthBackJump(r rune, runes []rune, runeOffset, spacingOffset int) int

func RuneWidthJump added in v0.4.0

func RuneWidthJump(r rune, offset int) int

Types

type File added in v0.4.0

type File struct {
	Name string

	First *Line

	Current *Line
	Lines   int
	// contains filtered or unexported fields
}

func (*File) Add added in v0.4.0

func (file *File) Add(character rune) (xPosition int, addedLine bool)

func (*File) Backspace added in v0.4.0

func (file *File) Backspace() (xPosition int, deletedLine bool)

func (*File) CanSafeQuit added in v0.4.0

func (file *File) CanSafeQuit() bool

func (*File) Down added in v0.4.0

func (file *File) Down(isInsert bool) (wasPossible bool, xPosition int)

func (*File) EndOfLine added in v0.5.0

func (file *File) EndOfLine(isInsert bool) (xPosition int)

func (*File) Init added in v0.4.0

func (file *File) Init(fileName string)

func (*File) JumpToBottom added in v0.5.0

func (file *File) JumpToBottom() (xPosition int)

func (*File) JumpToTop added in v0.5.0

func (file *File) JumpToTop() (xPosition int)

func (*File) Left added in v0.4.0

func (file *File) Left() (xPosition int)

func (*File) NextWordEnd added in v0.5.0

func (file *File) NextWordEnd() (xPosition int, linesDown int)

NextWordEnd will move the cursor to the end of the current word, unless the cursor is at the end of a word or on whitespace, in which case it will move to the end of the next word, if there is one, otherwise it will move the cursor to the end of the file.

func (*File) NextWordStart added in v0.5.0

func (file *File) NextWordStart() (xPosition int, linesDown int)

NextWordStart will move the cursor to the start of the next word, unless there is no next word, in which case the cursor moves to the end of the file.

func (*File) PrevWordStart added in v0.5.0

func (file *File) PrevWordStart() (xPosition int, linesUp int)

PrevWordStart will move the cursor to the start of the current word, unless the cursor is at the start of a word or on whitespace, in which case it will move to the start of the previous word, if there is one, otherwise it will move the cursor to the start of the file.

func (*File) Remove added in v0.4.0

func (file *File) Remove() (xPosition int)

func (*File) RemoveBefore added in v0.4.0

func (file *File) RemoveBefore() (xPosition int)

func (*File) RemoveLine added in v0.4.0

func (file *File) RemoveLine(isInsert bool) (xPosition int, wasFirst bool, wasLast bool)

func (*File) RemoveRestOfLine added in v0.4.0

func (file *File) RemoveRestOfLine(isInsert bool) (xPosition int)

func (*File) Right added in v0.4.0

func (file *File) Right(isInsert bool) (xPosition int)

func (*File) Save added in v0.4.0

func (file *File) Save() error

func (*File) StartOfLine added in v0.5.0

func (file *File) StartOfLine() (xPosition int)

func (*File) Up added in v0.4.0

func (file *File) Up(isInsert bool) (wasPossible bool, xPosition int)

type Line added in v0.4.0

type Line struct {
	Data []rune
	Next *Line
	Prev *Line
}

func (*Line) AddAt added in v0.4.0

func (line *Line) AddAt(index int, character rune)

func (*Line) Init added in v0.4.0

func (line *Line) Init(next, prev *Line)

func (*Line) RemoveAt added in v0.4.0

func (line *Line) RemoveAt(index int)

Jump to

Keyboard shortcuts

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