buffer

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: May 23, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWhitespace added in v0.4.2

func IsWhitespace(r rune) bool

Types

type Buffer

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

func MakeBuffer

func MakeBuffer(stringBuf []string) Buffer

func MakeSplitBuffer

func MakeSplitBuffer(bigString string, lineLen int) Buffer

MakeSplitBuffer creates a buffer from a long string by splitting the string at a certain length.

func (*Buffer) Append

func (buffer *Buffer) Append(line ...Line)

func (*Buffer) CompressPriorSpaces added in v0.4.2

func (buffer *Buffer) CompressPriorSpaces(row, col int) int

func (*Buffer) DeepDup

func (buffer *Buffer) DeepDup() Buffer

DeepDup creates a new buffer with copies of the lines.

func (*Buffer) DeleteRow

func (buffer *Buffer) DeleteRow(row int)

func (*Buffer) Dup

func (buffer *Buffer) Dup() Buffer

Dup creates a new buffer with the same lines.

func (*Buffer) Equals

func (buffer *Buffer) Equals(buffer2 *Buffer) bool

func (*Buffer) GetIndent

func (buffer *Buffer) GetIndent() (string, bool)

func (*Buffer) GetRow

func (buffer *Buffer) GetRow(row int) Line

func (*Buffer) InclSlice

func (buffer *Buffer) InclSlice(row1, row2 int) *Buffer

func (*Buffer) InsertAfter

func (buffer *Buffer) InsertAfter(row int, lines ...Line)

func (*Buffer) Length

func (buffer *Buffer) Length() int

Length returns the number of lines in the buffer.

func (*Buffer) Lines

func (buffer *Buffer) Lines() []Line

func (*Buffer) ReplaceBuffer

func (buffer *Buffer) ReplaceBuffer(newBuffer Buffer)

ReplaceBuffer replaces the content (lines) with the content from another buffer.

func (*Buffer) ReplaceLine

func (buffer *Buffer) ReplaceLine(line Line, row int)

func (*Buffer) ReplaceLines

func (buffer *Buffer) ReplaceLines(lines []Line, minRow, maxRow int)

ReplaceLines replaces the lines from minRow to maxRow with lines.

func (*Buffer) ReplaceWord

func (buffer *Buffer) ReplaceWord(searchTerm, replaceTerm string, row, col int)

Replace replaces occurrences of a string within a line.

func (*Buffer) RowLength

func (buffer *Buffer) RowLength(row int) int

func (*Buffer) RowSlice

func (buffer *Buffer) RowSlice(row, startCol, endCol int) Line

func (*Buffer) Search

func (buffer *Buffer) Search(searchTerm string, cursor cursor.Cursor, loop bool) (int, int, error)

Search searches for a string within the buffer.

func (*Buffer) SetRow

func (buffer *Buffer) SetRow(row int, line Line) error

func (*Buffer) StrSlab

func (buffer *Buffer) StrSlab(row1, row2, col1, col2 int) []string

func (*Buffer) ToString

func (buffer *Buffer) ToString(newline string) string

ToString concatenates the buffer into one long string.

type Line

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

func MakeLine

func MakeLine(str string) Line

func (*Line) Chars

func (line *Line) Chars() []rune

func (Line) CommonStart

func (line Line) CommonStart(other Line) Line

CommonStart returns the sub-line that is common between two lines.

func (Line) CompressPriorSpaces added in v0.4.2

func (line Line) CompressPriorSpaces(col int) (Line, int)

func (Line) Dup

func (line Line) Dup() Line

Dup returns a new Line with the same content.

func (*Line) GetChar

func (line *Line) GetChar(k int) rune

func (Line) Length

func (line Line) Length() int

func (*Line) PrevNextWord added in v0.4.3

func (line *Line) PrevNextWord(col, incr int) int

PrevNextWord returns the column position of the next/previous word from the current column position.

func (Line) RemoveTrailingWhitespace

func (line Line) RemoveTrailingWhitespace() Line

func (Line) Search

func (line Line) Search(term string, start, end int) (int, int)

Search returns the start/end positions for a search term. A -1 indicates no match.

func (*Line) SetChar

func (line *Line) SetChar(k int, c rune) error

func (Line) Slice

func (line Line) Slice(startCol, endCol int) Line

func (Line) StrSlice

func (line Line) StrSlice(startCol, endCol int) string

func (Line) Tabs2spaces

func (line Line) Tabs2spaces() Line

func (Line) ToString

func (line Line) ToString() string

ToString converts a Line into a string.

Jump to

Keyboard shortcuts

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