Version: v0.2.2 Latest Latest

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 5 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Buffer

type Buffer struct {
	// contains filtered or unexported fields

Buffer represents a buffer.

func NewBuffer

func NewBuffer(r readAtSeeker) *Buffer

NewBuffer creates a new buffer.

func (*Buffer) Clone

func (b *Buffer) Clone() *Buffer

Clone the buffer.

func (*Buffer) Copy

func (b *Buffer) Copy(start, end int64) *Buffer

Copy a part of the buffer.

func (*Buffer) Cut

func (b *Buffer) Cut(start, end int64)

Cut a part of the buffer.

func (*Buffer) Delete

func (b *Buffer) Delete(offset int64)

Delete deletes a byte at the specific position.

func (*Buffer) EditedIndices

func (b *Buffer) EditedIndices() []int64

EditedIndices returns the indices of edited regions.

func (*Buffer) Flush

func (b *Buffer) Flush()

Flush temporary bytes.

func (*Buffer) Insert

func (b *Buffer) Insert(offset int64, c byte)

Insert inserts a byte at the specific position.

func (*Buffer) Len

func (b *Buffer) Len() (int64, error)

Len returns the total size of the buffer.

func (*Buffer) Paste

func (b *Buffer) Paste(offset int64, c *Buffer)

Paste a buffer into a buffer.

func (*Buffer) Read

func (b *Buffer) Read(p []byte) (int, error)

Read reads bytes.

func (*Buffer) ReadAt

func (b *Buffer) ReadAt(p []byte, offset int64) (int, error)

ReadAt reads bytes at the specific offset.

func (*Buffer) Replace

func (b *Buffer) Replace(offset int64, c byte)

Replace replaces a byte at the specific position. This method does not overwrite the reader ranges, but just append the byte to the temporary byte slice in order to cancel the replacement with backspace key.

func (*Buffer) ReplaceIn

func (b *Buffer) ReplaceIn(start, end int64, c byte)

ReplaceIn replaces a byte within a specific range.

func (*Buffer) Seek

func (b *Buffer) Seek(offset int64, whence int) (int64, error)

Seek sets the offset.

func (*Buffer) UndoReplace

func (b *Buffer) UndoReplace(offset int64)

UndoReplace removes the last byte of the replacing byte slice.

Jump to

Keyboard shortcuts

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