file

package
v0.0.0-...-7150ffa Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRows

func NewRows() *rows

func Split

func Split(s []rune, sep rune) (r [][]rune)

Split s []rune by sep rune sep is not deleted

Types

type Action

type Action struct {
	Class  ActionClass
	Before Cursor
	After  Cursor
	Data   []rune
}

type ActionClass

type ActionClass int
const (
	Insert ActionClass = iota
	Delete
	DeleteBackward
	ActionSeparator
)

type ActionGroup

type ActionGroup []Action

func NewActionGroup

func NewActionGroup() *ActionGroup

func (*ActionGroup) IsEmpty

func (ag *ActionGroup) IsEmpty() bool

func (*ActionGroup) MoveTo

func (undo *ActionGroup) MoveTo(redo *ActionGroup)

This bad function Move Undo ActionGroup to Redo

func (*ActionGroup) Pop

func (ag *ActionGroup) Pop() (lastAction Action, _ bool)

try before isUndoEmpty() method

func (*ActionGroup) Push

func (ag *ActionGroup) Push(a Action)

type Cursor

type Cursor struct {
	RowIndex int
	ColIndex int
}

func NewCursor

func NewCursor(row, col int) Cursor

Create new Cursor struct and return

func (Cursor) Equals

func (c Cursor) Equals(other Cursor) bool

type Encoder

type Encoder interface {
	Encoder(string, *[]byte) error // Save file
	GuessCharset(path string, bytes int) (string, error)
	Decoder(*[]byte) (string, error) // Load file
	IsDecodedMessage(error) bool
}

type File

type File struct {
	Undo *ActionGroup
	Redo *ActionGroup
	// contains filtered or unexported fields
}

func NewFile

func NewFile(rawPath string) *File

Call New() or Load() after invoking this function

func (*File) Backup

func (ff *File) Backup() error

would like to consider other formats such as dates.

func (*File) ChangePath

func (ff *File) ChangePath(path string)

func (*File) GetBase

func (ff *File) GetBase() string

func (*File) GetClass

func (ff *File) GetClass() string

func (*File) GetDispPath

func (ff *File) GetDispPath() string

func (*File) GetEncoding

func (ff *File) GetEncoding() string

func (*File) GetLinefeed

func (ff *File) GetLinefeed() string

func (*File) GetPath

func (ff *File) GetPath() string

func (*File) GetRegion

func (ff *File) GetRegion(cursor1, cursor2 Cursor) *[]rune

No undo/redo functionality

func (*File) GetTabWidth

func (ff *File) GetTabWidth() int

func (*File) Insert

func (ff *File) Insert(cursor Cursor, s []rune) (Cursor, bool)

Return row,col, No undo/redo functionality

func (*File) IsDirtyFlag

func (ff *File) IsDirtyFlag() bool

func (File) IsLastRow

func (m File) IsLastRow(rowIndex int) bool

func (*File) IsReadonly

func (ff *File) IsReadonly() bool

func (*File) IsSoftTab

func (ff *File) IsSoftTab() bool

func (File) LenRows

func (m File) LenRows() int

func (*File) Load

func (ff *File) Load() error

Load file

func (*File) New

func (ff *File) New() error

New file

func (*File) RemoveRegion

func (ff *File) RemoveRegion(cursor1, cursor2 Cursor) *[]rune

No undo/redo functionality

func (*File) RemoveRow

func (ff *File) RemoveRow(cursor1 Cursor) *[]rune

No undo/redo functionality

func (*File) Row

func (ff *File) Row(rowIndex int) *Row

func (*File) Rows

func (ff *File) Rows() *rows

func (*File) Save

func (ff *File) Save() error

func (*File) SetPath

func (ff *File) SetPath(path string)

func (*File) SetReadonly

func (ff *File) SetReadonly(b bool)

func (*File) SetSoftTab

func (ff *File) SetSoftTab(b bool)

type Row

type Row []rune

func NewRow

func NewRow() *Row

func (*Row) BigginingSpaces

func (m *Row) BigginingSpaces() (runes []rune)

Return the indented string at the beginning of the line

func (*Row) Ch

func (m *Row) Ch(index int) rune

func (*Row) IsEndOfRow

func (m *Row) IsEndOfRow(colIndex int) bool

end of line determination

func (*Row) LenCh

func (m *Row) LenCh() int

Return length of the Row

func (*Row) String

func (m *Row) String() string

Jump to

Keyboard shortcuts

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