editor

package
v0.0.0-...-664e7a7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

The Editor provides the interface for navigating/editing the math equation, that an app can then bind controls to such methods

Index

Constants

View Source
const (
	DIR_LEFT Direction = iota
	DIR_RIGHT

	// TODO rename/use container type?
	EDIT_EQUATION editorState = iota // equation editing mode (normal)
	EDIT_TEXT
	EDIT_COMMAND
)
View Source
const KeybindsHelp = `` /* 287-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction int

type Editor

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

func New

func New(formula string) *Editor

func NewWithConfig

func NewWithConfig(cfg EditorConfig, formula string) *Editor

func (*Editor) DeleteBack

func (e *Editor) DeleteBack()

func (*Editor) FocusedTextField

func (e *Editor) FocusedTextField() latex.RunesContainer

Returns the currently focused text field (RunesContainer) or nil

func (*Editor) GetState

func (e *Editor) GetState() editorState

gets the 'state' of the editor, e.g. inserting a command/text node, or in normal equation node

func (*Editor) InsertCmd

func (e *Editor) InsertCmd(cmd string)

func (*Editor) InsertFrac

func (e *Editor) InsertFrac(detectNumerator bool)

func (Editor) LatexSource

func (e Editor) LatexSource() string

func (*Editor) NavigateDown

func (e *Editor) NavigateDown()

func (*Editor) NavigateLeft

func (e *Editor) NavigateLeft() bool

Navigates cursor to the left, exits a parent container if there is no left sibling Enters a Container if left sibling is one that allows entering Does nothing and returns false if we're the first child of the root node

func (*Editor) NavigateRight

func (e *Editor) NavigateRight() bool

Navigates cursor to the right, exits a parent container if there is no right sibling Enters a Container if right sibling is one that allows entering Does nothing and returns false if we're the last child of the root node

func (*Editor) NavigateToBeginning

func (e *Editor) NavigateToBeginning()

func (*Editor) NavigateToEnd

func (e *Editor) NavigateToEnd()

func (*Editor) NavigateUp

func (e *Editor) NavigateUp()

func (*Editor) Read

func (e *Editor) Read(latex string)

func (*Editor) Renderer

func (e *Editor) Renderer() *renderer.Renderer

func (*Editor) SetFocus

func (e *Editor) SetFocus(f bool)

func (Editor) Update

func (e Editor) Update(msg tea.Msg) (Editor, tea.Cmd)

func (Editor) View

func (e Editor) View() string

type EditorConfig

type EditorConfig struct {
	*log.Logger
	LatexCfg render.LatexSourceConfig
}

Jump to

Keyboard shortcuts

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