te

package module
v0.0.0-...-01db604 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 22 Imported by: 2

README

te - Text Editor Functionalities for ge

te is a package that provides text editor functionalities for the ge text editor.

Features

  • Default view in ge: Provides the default view for the ge text editor.
  • Includes functionalities for cursor movement, text editing, and more.

Installation

To use te in your Go project, you can simply import it as follows:

import "github.com/ge-editor/te"

Then, you can use the functionalities provided by te in your project.

Contributing

Contributions to te are welcome! If you find any issues or have suggestions for improvement, please feel free to open an issue or create a pull request on the GitHub repository.

License

This package is licensed under the MIT License. See the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	INSERT syncType = iota
	DELETE
)

Variables

View Source
var (
	// Initialization has been moved to the newEditor function
	// BufferSets, _ = buffer.NewBufferSets(gecore.Files)
	BufferSets *buffer.BufferSets
	Marks      = mark.NewMarks()
)

Functions

func NewView

func NewView() tree.View

Types

type BoundariesArray

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

Don't want to separate it into a separate package.

func NewBoundariesArray

func NewBoundariesArray(editor *Editor) BoundariesArray

func (*BoundariesArray) BoundariesLen

func (b *BoundariesArray) BoundariesLen(rowIndex int) int

Return number of logical row

func (*BoundariesArray) Boundary

func (b *BoundariesArray) Boundary(rowIndex, logicalRowIndex int) Boundary

Return the logical row boundary information

func (*BoundariesArray) ClearAll

func (b *BoundariesArray) ClearAll()

func (*BoundariesArray) Delete

func (b *BoundariesArray) Delete(rowIndex, count int) error

func (*BoundariesArray) Insert

func (b *BoundariesArray) Insert(rowIndex, count int)

Insert count number of elements into BoundariesArray at rowIndex position.

func (*BoundariesArray) LastBoundary

func (b *BoundariesArray) LastBoundary(rowIndex int) Boundary

func (*BoundariesArray) Len

func (b *BoundariesArray) Len() int

Return BoundariesArray length

func (*BoundariesArray) Set

func (b *BoundariesArray) Set(rowIndex int, bs []Boundary)

Set a Boundary-Array (logical row information) at a specified row index, extending the slice if necessary

type Boundary

type Boundary struct {
	StartIndex int
	StopIndex  int
	Width      int
	TotalWidth int
}

func (*Boundary) Clear

func (b *Boundary) Clear()

func (*Boundary) IsEmpty

func (b *Boundary) IsEmpty() bool

type Editor

type Editor struct {
	utils.Rect // overall position on screen

	*file.File
	*buffer.Meta
	// contains filtered or unexported fields
}

Editor Struct implements the gecore.tree.Leaf interface

func (*Editor) Autoindent

func (e *Editor) Autoindent()

func (*Editor) ChangeFilePath

func (e *Editor) ChangeFilePath(path string)

If an existing file is specified, it will be overwritten Backup works so no data is lost, but...

func (*Editor) CharInfo

func (e *Editor) CharInfo()

func (*Editor) CopyRegion

func (e *Editor) CopyRegion()

Copy cursor region to Kill Buffer and Clipboard

func (*Editor) DeleteRune

func (e *Editor) DeleteRune()

If at the EOL, move contents of the next line to the end of the current line, erasing the next line after that. Otherwise, delete one character under the cursor.

func (*Editor) DeleteRuneBackward

func (e *Editor) DeleteRuneBackward()

func (*Editor) Draw

func (e *Editor) Draw()

func (*Editor) Event

func (e *Editor) Event(tev *tcell.Event) *tcell.Event

If event requires special handling For EventResize, use the Resize method of interface

func (*Editor) GetBuffers

func (e *Editor) GetBuffers() *buffer.BufferSets

func (*Editor) GetFindIndexes

func (e *Editor) GetFindIndexes() []foundPosition

func (*Editor) Init

func (e *Editor) Init()

func (*Editor) InsertRune

func (e *Editor) InsertRune(ch rune)

Wrapper is insertBytes

func (*Editor) InsertString

func (e *Editor) InsertString(s string)

Wrapper is insertBytes

func (*Editor) InsertTab

func (e *Editor) InsertTab()

func (*Editor) Kill

func (e *Editor) Kill(leaf *tree.Leaf, isActive bool) *tree.Leaf

This function is called once for each tree.Leaf on the screen.

func (*Editor) KillLine

func (e *Editor) KillLine()

Kill line: If not at the EOL, remove contents of the current line from the cursor to the end. Otherwise behave like 'delete'. 行を削除します: EOL でない場合は、カーソルから末尾までの現在の行の内容を削除します。 それ以外の場合は、「delete」のように動作します。

func (*Editor) KillRegion

func (e *Editor) KillRegion()

Kill region between last mark to cursor and push undo and kill buffers

func (*Editor) MoveCursorBackward

func (e *Editor) MoveCursorBackward()

Move cursor one character backward.

func (*Editor) MoveCursorBeginningOfFile

func (e *Editor) MoveCursorBeginningOfFile()

func (*Editor) MoveCursorBeginningOfLine

func (e *Editor) MoveCursorBeginningOfLine()

Move cursor to the beginning of the line.

func (*Editor) MoveCursorBeginningOfLogicalLine

func (e *Editor) MoveCursorBeginningOfLogicalLine()

Move cursor to the beginning of the logical line.

func (*Editor) MoveCursorEndOfFile

func (e *Editor) MoveCursorEndOfFile()

func (*Editor) MoveCursorEndOfLine

func (e *Editor) MoveCursorEndOfLine()

Move cursor to the end of the line.

func (*Editor) MoveCursorEndOfLogicalLine

func (e *Editor) MoveCursorEndOfLogicalLine()

Move cursor to the end of logical the line. At the end of a logical line, the cursor should at the beginning of the next logical line. so I see...

func (*Editor) MoveCursorForward

func (e *Editor) MoveCursorForward()

Move cursor one character forward.

func (*Editor) MoveCursorNextLine

func (e *Editor) MoveCursorNextLine()

Move cursor to the next line.

func (*Editor) MoveCursorNextWord

func (e *Editor) MoveCursorNextWord()

Move cursor to next word.

func (*Editor) MoveCursorPrevLine

func (e *Editor) MoveCursorPrevLine()

Move cursor to the previous line.

func (*Editor) MoveCursorPreviousWord

func (e *Editor) MoveCursorPreviousWord()

func (*Editor) MoveCursorToLine

func (e *Editor) MoveCursorToLine(lineNumber int)

func (*Editor) MoveNextFoundWord

func (e *Editor) MoveNextFoundWord()

func (*Editor) MovePrevFoundWord

func (e *Editor) MovePrevFoundWord()

func (*Editor) MoveViewHalfBackward

func (e *Editor) MoveViewHalfBackward()

Move view 'n' lines forward or backward.

func (*Editor) MoveViewHalfForward

func (e *Editor) MoveViewHalfForward()

Move view 'n' lines forward or backward only if it's possible.

func (*Editor) OpenFile

func (e *Editor) OpenFile(path string) error

If the file has already been read, use that buffer

func (*Editor) Redo

func (e *Editor) Redo()

func (*Editor) Redraw

func (e *Editor) Redraw()

func (*Editor) ReplaceCurrentSearchString

func (e *Editor) ReplaceCurrentSearchString(str string)

func (*Editor) Resize

func (e *Editor) Resize(width, height int, rect utils.Rect)

func (*Editor) Resume

func (e *Editor) Resume()

func (*Editor) SaveFile

func (e *Editor) SaveFile()

If the file does not exist, a backup error will occur

func (*Editor) SearchRegexp

func (e *Editor) SearchRegexp(searchTerm string, caseSensitive bool, ctx context.Context)

func (*Editor) SearchText

func (e *Editor) SearchText(text string, caseSensitive, isRegexp bool, ctx context.Context, wg *sync.WaitGroup)

When not using regular expressions

func (*Editor) SetFile

func (e *Editor) SetFile(ff *file.File)

Should use OpenFile instead of?

func (*Editor) SetMark

func (e *Editor) SetMark()

func (*Editor) SwapCursorAndMark

func (e *Editor) SwapCursorAndMark()

func (*Editor) Undo

func (e *Editor) Undo()

func (*Editor) View

func (e *Editor) View() *tree.View

func (*Editor) ViewActive

func (e *Editor) ViewActive(a bool)

func (*Editor) WillClose

func (e *Editor) WillClose()

func (*Editor) Yank

func (e *Editor) Yank()

func (*Editor) YankFromClipboard

func (e *Editor) YankFromClipboard()

type Number

type Number interface {
	int | int32 | int64 | float32 | float64
}

type View

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

Implements View interface

func (*View) Name

func (v *View) Name() string

func (*View) NewLeaf

func (v *View) NewLeaf() *tree.Leaf

Return *te.Editor as *tree.Leaf interface

func (*View) NewSiblingLeaf

func (v *View) NewSiblingLeaf(direction string, leaf *tree.Leaf) *tree.Leaf

Create a new tree.Leaf (Editor) from leaf *tree.Leaf information direction: "right", "bottom"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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