shared

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string // Command name without prefix
	Syntax      string // Full syntax example (e.g., ":help")
	Description string // Brief description
}

Command defines a REPL command with its syntax and description.

func DefaultCommands

func DefaultCommands() []Command

DefaultCommands returns the list of available commands for Simple REPL.

type Dimensions

type Dimensions struct {
	Width  int
	Height int
}

Dimensions holds terminal dimensions.

func MinDimensions

func MinDimensions() Dimensions

MinDimensions returns minimum usable dimensions.

type HistoryEntry

type HistoryEntry struct {
	Input   string // The expression or command entered
	Output  string // The result (formatted)
	IsError bool   // Whether this was an error
}

HistoryEntry represents a single REPL history entry.

type InputMode

type InputMode int

InputMode represents the input state within a mode.

const (
	InputNormal   InputMode = iota // Normal input
	InputCommand                   // Command entry (triggered by ":")
	InputMarkdown                  // Multi-line markdown entry
	InputEditing                   // Line editing in editor
)

type KeyMap

type KeyMap struct {
	// Global keys (work in all modes)
	Quit key.Binding
	Help key.Binding

	// Navigation keys
	Up        key.Binding
	Down      key.Binding
	Left      key.Binding
	Right     key.Binding
	WordLeft  key.Binding
	WordRight key.Binding
	LineStart key.Binding
	LineEnd   key.Binding
	PageUp    key.Binding
	PageDown  key.Binding
	Home      key.Binding
	End       key.Binding

	// Action keys
	Enter  key.Binding
	Escape key.Binding
	Tab    key.Binding

	// Editor-specific keys (used in editor mode)
	Edit       key.Binding
	Save       key.Binding
	Open       key.Binding
	Undo       key.Binding
	Redo       key.Binding
	InsertLine key.Binding
	DeleteLine key.Binding
	NewLine    key.Binding
	Backspace  key.Binding
	DeleteWord key.Binding
}

KeyMap defines key bindings for the TUI. Centralized here for consistency across all modes.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings.

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns key bindings to show in full help. Organized by category: Navigation, Word Navigation, Editing, File, Other.

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns key bindings to show in short help.

type Mode

type Mode int

Mode represents the current TUI mode.

const (
	ModeREPL     Mode = iota // Simple REPL mode
	ModeEditor               // Document editor mode
	ModeHelp                 // Help viewer
	ModeFilePick             // File picker
)

type PinnedVar

type PinnedVar struct {
	Name          string
	Value         types.Type // The actual value
	Changed       bool       // Was this variable modified in the last operation?
	IsFrontmatter bool       // Is this a frontmatter variable?
}

PinnedVar represents a variable displayed in the pinned panel.

type SwitchModeMsg

type SwitchModeMsg struct {
	Mode     Mode   // Target mode
	Filepath string // Optional file path for editor mode
}

SwitchModeMsg is a message to switch to a different mode.

Jump to

Keyboard shortcuts

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