buf

package
v0.0.0-...-a0dc7b2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const CLOSED_PARENTHESIS = ")]}>"
View Source
const OPEN_PARENTHESIS = "([{<"
View Source
const SLOP = 128

Variables

View Source
var TYPING_INTERVAL = time.Duration(2 * time.Second)

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	Dir           string
	Name          string
	Editable      bool
	EditableStart int
	Modified      bool

	Props map[string]string

	Hl hl.Highlighter

	RevCount int

	Words       []string
	WordsUpdate time.Time

	EditMark, EditMarkNext bool

	// used to implement shift+movement selection actions
	Markat int

	DumpCmd, DumpDir string
	// contains filtered or unexported fields
}

func NewBuffer

func NewBuffer(dir, name string, create bool, indentchar string, hl hl.Highlighter) (b *Buffer, err error)

func (*Buffer) AddSel

func (b *Buffer) AddSel(sel *util.Sel)

func (*Buffer) At

func (b *Buffer) At(p int) rune

func (*Buffer) ByteOffset

func (b *Buffer) ByteOffset(p int) int

func (*Buffer) BytesSize

func (buf *Buffer) BytesSize() (r BufferSize)

func (*Buffer) CanSave

func (b *Buffer) CanSave() bool

func (*Buffer) DescribeUndo

func (buf *Buffer) DescribeUndo() string

func (*Buffer) FixSel

func (b *Buffer) FixSel(sel *util.Sel)

func (*Buffer) FlushUndo

func (b *Buffer) FlushUndo()

func (*Buffer) GetLine

func (b *Buffer) GetLine(i int, utf16col bool) (string, int, int)

func (*Buffer) HasRedo

func (b *Buffer) HasRedo() bool

func (*Buffer) HasUndo

func (b *Buffer) HasUndo() bool

func (*Buffer) Highlight

func (buf *Buffer) Highlight(start, end int) []uint8

func (*Buffer) IncGap

func (b *Buffer) IncGap(delta int)

Increases the size of the gap to fit at least delta more items

func (*Buffer) IsDir

func (b *Buffer) IsDir() bool

func (*Buffer) LastEdit

func (b *Buffer) LastEdit() time.Time

func (*Buffer) LastEditIsType

func (b *Buffer) LastEditIsType(rev int) int

func (*Buffer) LastTypePos

func (b *Buffer) LastTypePos() int

func (*Buffer) MoveGap

func (b *Buffer) MoveGap(p int)

Displaces gap to start at point p

func (*Buffer) Path

func (b *Buffer) Path() string

func (*Buffer) Put

func (b *Buffer) Put() error

func (*Buffer) Rdlock

func (b *Buffer) Rdlock()

func (*Buffer) Rdunlock

func (b *Buffer) Rdunlock()

func (*Buffer) ReaderFrom

func (b *Buffer) ReaderFrom(s, e int) io.RuneReader

func (*Buffer) Reload

func (b *Buffer) Reload(flags ReloadFlag) error

(re)loads buffer from disk

func (*Buffer) Replace

func (b *Buffer) Replace(text []rune, sel *util.Sel, solid bool, eventChan chan string, origin util.EventOrigin)

Replaces text between sel.S and sel.E with text, updates sels AND sel accordingly After the replacement the highlighter is restarted

func (*Buffer) ReplaceAll

func (buf *Buffer) ReplaceAll(stash []ReplaceOp, eventChan chan string, origin util.EventOrigin)

func (*Buffer) ReplaceFull

func (b *Buffer) ReplaceFull(text []rune)

func (*Buffer) RmSel

func (b *Buffer) RmSel(sel *util.Sel)

func (*Buffer) Selection

func (b *Buffer) Selection(sel util.Sel) ([]rune, []rune)

Returns the specified selection as two slices. The slices are to be treated as contiguous and may be empty

func (*Buffer) SelectionRunes

func (b *Buffer) SelectionRunes(sel util.Sel) []rune

Returns the specified selection as single slice of ColorRunes (will allocate)

func (*Buffer) Sels

func (b *Buffer) Sels() []*util.Sel

func (*Buffer) ShortName

func (b *Buffer) ShortName() string

func (*Buffer) Size

func (b *Buffer) Size() int

func (*Buffer) Tof

func (b *Buffer) Tof(start int, dir int, f func(rune) bool) int

Moves to the first position where f returns true

func (*Buffer) Tofp

func (b *Buffer) Tofp(start int, dir int) int

Moves to the beginning or end of something that looks like a file path

func (*Buffer) Tonl

func (b *Buffer) Tonl(start int, dir int) int

Moves to the beginning or end of a line

func (*Buffer) Topmatch

func (b *Buffer) Topmatch(start int, dir int) int

Moves to the matching parenthesis of the one at 'start' in the specified direction

func (*Buffer) Toregend

func (buf *Buffer) Toregend(start int) int

func (*Buffer) Tospc

func (b *Buffer) Tospc(start int, dir int, dontForceAdvance bool) int

Moves to the beginning or end of a space delimited word

func (*Buffer) Towd

func (b *Buffer) Towd(start int, dir int, dontForceAdvance bool) int

Moves to the beginning or end of an alphanumerically delimited word

func (*Buffer) UTF16Pos

func (buf *Buffer) UTF16Pos(ln, col int) int

func (*Buffer) Undo

func (b *Buffer) Undo(sel *util.Sel, redo bool)

Undo last change. Redoes last undo if redo == true

func (*Buffer) UndoReset

func (b *Buffer) UndoReset()

func (*Buffer) UndoWhere

func (b *Buffer) UndoWhere() int

func (*Buffer) UpdateWords

func (b *Buffer) UpdateWords()

type BufferSize

type BufferSize struct {
	GapUsed, GapGap uintptr
	Words           uintptr
	Undo            uintptr
}

description of buffer size, for debugging purposes

type ReloadFlag

type ReloadFlag uint8
const (
	ReloadCreate ReloadFlag = 1 << iota
	ReloadPreserveCurlineWhitespace
)

type ReplaceOp

type ReplaceOp struct {
	Text []rune
	Sel  util.Sel
}

Jump to

Keyboard shortcuts

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