te

package module
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: 21 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

This section is empty.

Variables

View Source
var (
	BufferSets, _ = buffer.NewBufferSets(gecore.Files)
	Marks         = mark.NewMarks()
)

Functions

func NewView

func NewView() tree.View

Types

type Editor

type Editor struct {
	utils.Rect // over all // 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) DrawLine

func (e *Editor) DrawLine(n, rowIndex, cursorLogicalCY int)

draw one row

  • n: y position within the Leaf to draw the row
  • cursorLogicalCY: Logical row number where the cursor is located, If the row to draw is not the cursor row, set -1 and call

func (*Editor) Event

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

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)

Insert a rune 'ch' at the current cursor position, advance cursor one character forward.

func (*Editor) InsertString

func (e *Editor) InsertString(s string) (file.Cursor, bool)

func (*Editor) InsertTab

func (e *Editor) InsertTab()

func (*Editor) Kill

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

This Kill function will be called twice in a row First call to active tree.Leaf The second time is a circular call to tree

Process active tree.Leaf in first call Remove from buffer BufferSets matching leafEditor.File

Handle non-active windows in second call Check if Editor.File exists in BufferSets If it doesn't exist, replace it with another buffer

func (*Editor) KillLine

func (e *Editor) KillLine()

If not at the EOL, remove contents of the current line from the cursor to the end. Otherwise behave like 'delete'.

func (*Editor) Kill_region

func (e *Editor) Kill_region()

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) MoveCursorPrevLine

func (e *Editor) MoveCursorPrevLine()

Move cursor to the previous line.

func (*Editor) MoveCursorToLine

func (e *Editor) MoveCursorToLine(lineNumber int)

"lemp" stands for "line edit mode params"

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) 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) SyncEdits

func (e *Editor) SyncEdits(sync syncType, ff *file.File, start, end file.Cursor)

Synchronize edits to other buffers

Synchronize cursor position and vline:

  • BufferSets.metas[*].Cursor
  • Editor.Cursor
  • Editor.vlines

func (*Editor) VC_Redo

func (e *Editor) VC_Redo()

func (*Editor) VC_Undo

func (e *Editor) VC_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 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