buffer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Insert operation
	Change
	Delete
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	Title string

	Copies     []*copied
	Lines      []*Line
	Cursor     *cursor
	Visual     *cursor
	UndoStack  []snapshot
	RedoStack  []snapshot
	IsReadOnly bool
	Type       buffers.BufferType
	// contains filtered or unexported fields
}

Title - name of the oppened file pairs - used like a stask to keep track of paired brackets copies - sores copied lines Lines - List of lines Cursor - read pos of cursor UndoStack - stores list of snapshots. Used to move 'back in time' in file history Visual - anchor point for real cursor pos, used to calculate selected area in visual and visual-line modes IsReadOnly - ised to check if oppened file could be change IsMdFile - if file extations is not '.md', bard uses default reader instead of markdown one

func InitBuffer

func InitBuffer() []*Buffer

func (*Buffer) ChangeLetterCaseTo

func (b *Buffer) ChangeLetterCaseTo(Case cases.Case, isVisualLine bool)

func (*Buffer) ClearLine

func (b *Buffer) ClearLine()

func (*Buffer) CopyLine

func (b *Buffer) CopyLine(l *Line, startOffset int, endOffset int) *copied

Create a new line for the buffer.copied list

func (*Buffer) CopySelected

func (b *Buffer) CopySelected(isDelete bool, isVisualLine bool)

copies selected area into [copied], betven [Cursor] and [Visual] points

func (*Buffer) DelAndMoveLine

func (b *Buffer) DelAndMoveLine()

Called when the user deletes the 0th character in a line. The line is deleted and data is moved to the line above

func (*Buffer) DelAndMoveLineAt

func (b *Buffer) DelAndMoveLineAt(startLine int, endLine int, endOffset int)

func (*Buffer) DeleteUntilSpace

func (b *Buffer) DeleteUntilSpace()

func (*Buffer) Delkey

func (b *Buffer) Delkey()

Called when the user presses [x] or [s] in normal mode. It deletes the character and copies it to the buffer

func (*Buffer) DismissList

func (b *Buffer) DismissList() bool

func (*Buffer) EscapeToNormal

func (b *Buffer) EscapeToNormal()

func (*Buffer) FindBeforeNext

func (b *Buffer) FindBeforeNext(ch rune)

func (*Buffer) FindBeforePrev

func (b *Buffer) FindBeforePrev(ch rune)

func (*Buffer) FindNext

func (b *Buffer) FindNext(ch rune)

func (*Buffer) FindPrev

func (b *Buffer) FindPrev(ch rune)

func (*Buffer) FixOffset

func (b *Buffer) FixOffset()

func (*Buffer) H

func (b *Buffer) H(amount int)

Move Cursor left

func (*Buffer) InsertEmptyLine

func (b *Buffer) InsertEmptyLine(lineShift int)

func (*Buffer) InsertKey

func (b *Buffer) InsertKey(key rune)

func (*Buffer) InsertLine

func (b *Buffer) InsertLine()

Called when the user presses [enter] in the middle of a line. This function shifts data from the right to the new line

func (*Buffer) InsertLineWithData

func (b *Buffer) InsertLineWithData(index int, data []rune)

func (*Buffer) InsertPair

func (b *Buffer) InsertPair(key rune)

func (*Buffer) Insert_a

func (b *Buffer) Insert_a()

func (*Buffer) J

func (b *Buffer) J(amount int)

Move Cursor down

func (*Buffer) K

func (b *Buffer) K(amount int)

Move Cursor up

func (*Buffer) L

func (b *Buffer) L(amount int)

Move Cursor right

func (*Buffer) MoveBACK

func (b *Buffer) MoveBACK(amount int)

func (*Buffer) MoveBack

func (b *Buffer) MoveBack(amount int)

func (*Buffer) MoveEND

func (b *Buffer) MoveEND(amount int)

func (*Buffer) MoveEnd

func (b *Buffer) MoveEnd(amount int)

func (*Buffer) MoveToFirstChar

func (b *Buffer) MoveToFirstChar()

func (*Buffer) MoveToFirstLine

func (b *Buffer) MoveToFirstLine()

func (*Buffer) MoveToFirstVisible

func (b *Buffer) MoveToFirstVisible()

Move buffer.Cursor to the first non-space character in the line

func (*Buffer) MoveToLastChar

func (b *Buffer) MoveToLastChar()

func (*Buffer) MoveToLastLine

func (b *Buffer) MoveToLastLine()

func (*Buffer) MoveWORD

func (b *Buffer) MoveWORD(amount int)

func (*Buffer) MoveWord

func (b *Buffer) MoveWord(amount int)

func (*Buffer) Paste

func (b *Buffer) Paste(shift int)

func (*Buffer) Redo

func (b *Buffer) Redo() error

func (*Buffer) RemoveKey

func (b *Buffer) RemoveKey()

Called when the user presses [backspace] and just removes the character in front of it

func (*Buffer) RemoveLine

func (b *Buffer) RemoveLine()

Delete the whole line

func (*Buffer) RemoveLineAt

func (b *Buffer) RemoveLineAt(lineIndex int)

Delete the whole line at index

func (*Buffer) ReplaceKeys

func (b *Buffer) ReplaceKeys(key rune, amount int)

func (*Buffer) ResetKeepOffset

func (b *Buffer) ResetKeepOffset()

func (*Buffer) SaveChanges

func (b *Buffer) SaveChanges(op operation, start int, end int, with_prev bool)

func (*Buffer) SaveCopied

func (b *Buffer) SaveCopied()

func (*Buffer) ShiftLineLeft

func (b *Buffer) ShiftLineLeft(amount int)

func (*Buffer) ShiftLineRight

func (b *Buffer) ShiftLineRight(amount int)

func (*Buffer) StartVisual

func (b *Buffer) StartVisual()

func (*Buffer) StartVisualLine

func (b *Buffer) StartVisualLine()

func (*Buffer) SwapTail

func (b *Buffer) SwapTail()

func (*Buffer) Undo

func (b *Buffer) Undo() error

type Line

type Line struct {
	Data []rune
}

Jump to

Keyboard shortcuts

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