Documentation
¶
Index ¶
- Variables
- func ColorToANSI(fg, bg string) string
- func ColorToANSIBg(color string) string
- func ColorToANSIFg(color string) string
- func MinimapWidth() int
- type Column
- type ColumnRenderer
- type Compositor
- func (c *Compositor) AddColumn(col Column)
- func (c *Compositor) EnableColumn(index int, enabled bool)
- func (c *Compositor) FlexibleColumnWidth() int
- func (c *Compositor) GetColumns() []Column
- func (c *Compositor) Height() int
- func (c *Compositor) Render(state *RenderState) string
- func (c *Compositor) SetColumns(cols []Column)
- func (c *Compositor) SetSize(width, height int)
- func (c *Compositor) Width() int
- type KittyMinimapRenderer
- func (r *KittyMinimapRenderer) ClearImage() string
- func (r *KittyMinimapRenderer) GetKittySequence(width, height, xOffset, yOffset int, state *RenderState) string
- func (r *KittyMinimapRenderer) GetMetrics(viewportHeight int, state *RenderState) MinimapMetrics
- func (r *KittyMinimapRenderer) IsEnabled() bool
- func (r *KittyMinimapRenderer) Render(width, height int, state *RenderState) []string
- func (r *KittyMinimapRenderer) RowToVisualLine(row int, metrics MinimapMetrics) int
- func (r *KittyMinimapRenderer) SetEnabled(enabled bool)
- func (r *KittyMinimapRenderer) SetLineColorFunc(fn func(line string) []syntax.ColorSpan)
- func (r *KittyMinimapRenderer) SetStyles(styles Styles)
- func (r *KittyMinimapRenderer) SetUseKitty(useKitty bool)
- func (r *KittyMinimapRenderer) Toggle() bool
- func (r *KittyMinimapRenderer) UseKitty() bool
- type LineNumberRenderer
- type Menu
- type MenuAction
- type MenuBar
- func (m *MenuBar) Close()
- func (m *MenuBar) DropdownHeight() int
- func (m *MenuBar) HandleClick(x, y int) (bool, MenuAction)
- func (m *MenuBar) Height() int
- func (m *MenuBar) IsOpen() bool
- func (m *MenuBar) NextItem()
- func (m *MenuBar) NextMenu()
- func (m *MenuBar) OpenMenu(index int)
- func (m *MenuBar) PrevItem()
- func (m *MenuBar) PrevMenu()
- func (m *MenuBar) RenderDropdown() ([]string, int)
- func (m *MenuBar) Select() MenuAction
- func (m *MenuBar) SelectByHotKey(key rune) MenuAction
- func (m *MenuBar) SetBuffers(names []string, activeIdx int)
- func (m *MenuBar) SetItemDisabled(action MenuAction, disabled bool)
- func (m *MenuBar) SetItemLabel(action MenuAction, label string)
- func (m *MenuBar) SetStyles(styles Styles)
- func (m *MenuBar) SetWidth(width int)
- func (m *MenuBar) Toggle(index int)
- func (m *MenuBar) UpdateShortcuts(kb *config.KeybindingsConfig)
- func (m *MenuBar) View() string
- type MenuItem
- type MinimapController
- type MinimapMetrics
- type MinimapRenderer
- func (r *MinimapRenderer) ClearImage() string
- func (r *MinimapRenderer) GetKittySequence(width, height, xOffset, yOffset int, state *RenderState) string
- func (r *MinimapRenderer) GetMetrics(viewportHeight int, state *RenderState) MinimapMetrics
- func (r *MinimapRenderer) IsEnabled() bool
- func (r *MinimapRenderer) Render(width, height int, state *RenderState) []string
- func (r *MinimapRenderer) RowToVisualLine(row int, metrics MinimapMetrics) int
- func (r *MinimapRenderer) SetEnabled(enabled bool)
- func (r *MinimapRenderer) SetStyles(styles Styles)
- func (r *MinimapRenderer) Toggle() bool
- type RenderState
- type Scrollbar
- func (s *Scrollbar) Height() int
- func (s *Scrollbar) IsEnabled() bool
- func (s *Scrollbar) Render(viewportStart, viewportHeight, totalLines int) []string
- func (s *Scrollbar) RowToLine(row int, totalLines, viewportHeight int) int
- func (s *Scrollbar) SetEnabled(enabled bool)
- func (s *Scrollbar) SetHeight(height int)
- func (s *Scrollbar) SetStyles(styles Styles)
- func (s *Scrollbar) Toggle() bool
- func (s *Scrollbar) Width() int
- type ScrollbarColumnAdapter
- type SelectionRange
- type StatusBar
- func (s *StatusBar) ClearMessage()
- func (s *StatusBar) SetBufferInfo(index, count int)
- func (s *StatusBar) SetCounts(words, chars int)
- func (s *StatusBar) SetEncoding(encoding string, supported bool)
- func (s *StatusBar) SetFilename(filename string)
- func (s *StatusBar) SetMessage(message, msgType string)
- func (s *StatusBar) SetModified(modified bool)
- func (s *StatusBar) SetPosition(line, col int)
- func (s *StatusBar) SetStyles(styles Styles)
- func (s *StatusBar) SetTotalLines(total int)
- func (s *StatusBar) SetWidth(width int)
- func (s *StatusBar) View() string
- type Styles
- type TextRenderer
- type Viewport
- func (v *Viewport) CountVisualLines(lines []string) int
- func (v *Viewport) EnsureCursorVisible(cursorLine, cursorCol int)
- func (v *Viewport) EnsureCursorVisibleWrapped(lines []string, cursorLine, cursorCol int)
- func (v *Viewport) Height() int
- func (v *Viewport) LineNumberWidth() int
- func (v *Viewport) MoveDownVisual(lines []string, line, col int) (newLine, newCol int)
- func (v *Viewport) MoveUpVisual(lines []string, line, col int) (newLine, newCol int)
- func (v *Viewport) PageDown(totalLines int)
- func (v *Viewport) PageDownWrapped(lines []string)
- func (v *Viewport) PageUp()
- func (v *Viewport) PositionFromClick(x, y int) (line, col int)
- func (v *Viewport) PositionFromClickWrapped(lines []string, x, y int) (line, col int)
- func (v *Viewport) Render(lines []string, cursorLine, cursorCol int, selection map[int]SelectionRange, ...) string
- func (v *Viewport) ScrollDown(totalLines int)
- func (v *Viewport) ScrollDownWrapped(lines []string)
- func (v *Viewport) ScrollUp()
- func (v *Viewport) ScrollX() int
- func (v *Viewport) ScrollY() int
- func (v *Viewport) ScrollbarWidth() int
- func (v *Viewport) SetScrollX(x int)
- func (v *Viewport) SetScrollY(y int)
- func (v *Viewport) SetScrollbarWidth(width int)
- func (v *Viewport) SetSize(width, height int)
- func (v *Viewport) SetStyles(styles Styles)
- func (v *Viewport) SetTabWidth(width int)
- func (v *Viewport) SetWordWrap(wrap bool)
- func (v *Viewport) ShowLineNum() bool
- func (v *Viewport) ShowLineNumbers(show bool)
- func (v *Viewport) TabWidth() int
- func (v *Viewport) TextWidth() int
- func (v *Viewport) VisualLineToBufferLine(lines []string, visualLine int) (bufferLine int, wrapOffset int)
- func (v *Viewport) Width() int
- func (v *Viewport) WordWrap() bool
Constants ¶
This section is empty.
Variables ¶
var UseTrueColor = true
UseTrueColor controls whether hex colors use true color (24-bit) or fall back to the nearest 256-color. Set to false for older terminals.
Functions ¶
func ColorToANSI ¶
ColorToANSI returns combined fg+bg ANSI sequence
func ColorToANSIBg ¶
ColorToANSIBg converts a theme color string to an ANSI background escape sequence
func ColorToANSIFg ¶
ColorToANSIFg converts a theme color string to an ANSI foreground escape sequence Supports: "0"-"255" for indexed colors, "#RGB" or "#RRGGBB" for hex colors Hex colors use true color if UseTrueColor is true, otherwise nearest 256-color
func MinimapWidth ¶ added in v0.2.0
func MinimapWidth() int
MinimapWidth returns the standard width for the minimap column.
Types ¶
type Column ¶ added in v0.2.0
type Column struct {
Width int // Fixed width in cells (0 if flexible)
Flexible bool // If true, this column takes remaining space
Enabled bool // Whether this column is currently shown
Renderer ColumnRenderer // The renderer for this column
}
Column represents a single column in the compositor layout.
type ColumnRenderer ¶ added in v0.2.0
type ColumnRenderer interface {
// Render returns exactly `height` rows, each with exactly `width` visual characters.
// ANSI codes don't count toward width - only visible characters do.
Render(width, height int, state *RenderState) []string
}
ColumnRenderer is the interface that column renderers must implement. Each renderer produces exactly `width` visual characters per row.
type Compositor ¶ added in v0.2.0
type Compositor struct {
// contains filtered or unexported fields
}
Compositor joins multiple columns horizontally to produce the final viewport output.
func NewCompositor ¶ added in v0.2.0
func NewCompositor(width, height int) *Compositor
NewCompositor creates a new compositor with the given dimensions.
func (*Compositor) AddColumn ¶ added in v0.2.0
func (c *Compositor) AddColumn(col Column)
AddColumn adds a column to the compositor.
func (*Compositor) EnableColumn ¶ added in v0.2.0
func (c *Compositor) EnableColumn(index int, enabled bool)
EnableColumn enables or disables a column by index.
func (*Compositor) FlexibleColumnWidth ¶ added in v0.2.0
func (c *Compositor) FlexibleColumnWidth() int
FlexibleColumnWidth returns the calculated width of the flexible column. This is useful for external code that needs to know the text area width.
func (*Compositor) GetColumns ¶ added in v0.2.0
func (c *Compositor) GetColumns() []Column
GetColumns returns a copy of the current columns.
func (*Compositor) Height ¶ added in v0.2.0
func (c *Compositor) Height() int
Height returns the compositor height.
func (*Compositor) Render ¶ added in v0.2.0
func (c *Compositor) Render(state *RenderState) string
Render renders all enabled columns and joins them horizontally.
func (*Compositor) SetColumns ¶ added in v0.2.0
func (c *Compositor) SetColumns(cols []Column)
SetColumns replaces all columns.
func (*Compositor) SetSize ¶ added in v0.2.0
func (c *Compositor) SetSize(width, height int)
SetSize updates the compositor dimensions.
func (*Compositor) Width ¶ added in v0.2.0
func (c *Compositor) Width() int
Width returns the compositor width.
type KittyMinimapRenderer ¶ added in v0.2.0
type KittyMinimapRenderer struct {
// contains filtered or unexported fields
}
KittyMinimapRenderer renders a pixel-based minimap using Kitty graphics protocol. This provides a VSCode-like minimap with syntax highlighting colors.
Kitty graphics protocol reference: https://sw.kovidgoyal.net/kitty/graphics-protocol/
Design (VSCode-style):
- Each source character = 1 pixel wide
- Each source line = 2 pixels tall (for readability)
- Syntax highlighting colors preserved from the highlighter
- Viewport indicator = dark gray semi-transparent overlay on visible region
- Maximum 120 characters width shown (truncated, not scaled)
func NewKittyMinimapRenderer ¶ added in v0.2.0
func NewKittyMinimapRenderer(styles Styles, useKitty bool) *KittyMinimapRenderer
NewKittyMinimapRenderer creates a new Kitty graphics minimap renderer.
func (*KittyMinimapRenderer) ClearImage ¶ added in v0.2.0
func (r *KittyMinimapRenderer) ClearImage() string
ClearImage sends a Kitty graphics command to delete the minimap image. This should be called when disabling the minimap or exiting.
func (*KittyMinimapRenderer) GetKittySequence ¶ added in v0.2.0
func (r *KittyMinimapRenderer) GetKittySequence(width, height, xOffset, yOffset int, state *RenderState) string
GetKittySequence returns the Kitty graphics escape sequence to render the minimap. This should be appended to the View() output AFTER all normal rendering, with cursor positioning to place it at the minimap column location. Returns empty string if Kitty graphics is not enabled.
func (*KittyMinimapRenderer) GetMetrics ¶ added in v0.2.0
func (r *KittyMinimapRenderer) GetMetrics(viewportHeight int, state *RenderState) MinimapMetrics
GetMetrics calculates minimap metrics for mouse interaction.
func (*KittyMinimapRenderer) IsEnabled ¶ added in v0.2.0
func (r *KittyMinimapRenderer) IsEnabled() bool
IsEnabled returns whether the minimap is enabled.
func (*KittyMinimapRenderer) Render ¶ added in v0.2.0
func (r *KittyMinimapRenderer) Render(width, height int, state *RenderState) []string
Render implements ColumnRenderer. Returns blank spaces for the column area. The actual Kitty graphics is rendered separately via GetKittySequence() and appended to View() output.
func (*KittyMinimapRenderer) RowToVisualLine ¶ added in v0.2.0
func (r *KittyMinimapRenderer) RowToVisualLine(row int, metrics MinimapMetrics) int
RowToVisualLine converts a minimap row click to a visual line index.
func (*KittyMinimapRenderer) SetEnabled ¶ added in v0.2.0
func (r *KittyMinimapRenderer) SetEnabled(enabled bool)
SetEnabled enables or disables the minimap.
func (*KittyMinimapRenderer) SetLineColorFunc ¶ added in v0.2.0
func (r *KittyMinimapRenderer) SetLineColorFunc(fn func(line string) []syntax.ColorSpan)
SetLineColorFunc sets the callback for getting syntax colors for a line.
func (*KittyMinimapRenderer) SetStyles ¶ added in v0.2.0
func (r *KittyMinimapRenderer) SetStyles(styles Styles)
SetStyles updates the styles for runtime theme changes.
func (*KittyMinimapRenderer) SetUseKitty ¶ added in v0.2.0
func (r *KittyMinimapRenderer) SetUseKitty(useKitty bool)
SetUseKitty enables or disables Kitty graphics mode.
func (*KittyMinimapRenderer) Toggle ¶ added in v0.2.0
func (r *KittyMinimapRenderer) Toggle() bool
Toggle toggles the minimap on/off.
func (*KittyMinimapRenderer) UseKitty ¶ added in v0.2.0
func (r *KittyMinimapRenderer) UseKitty() bool
UseKitty returns whether Kitty graphics mode is active.
type LineNumberRenderer ¶ added in v0.2.0
type LineNumberRenderer struct {
// contains filtered or unexported fields
}
LineNumberRenderer renders line numbers in a column. Standard width is 5 (4 digits + 1 space separator).
func NewLineNumberRenderer ¶ added in v0.2.0
func NewLineNumberRenderer(styles Styles) *LineNumberRenderer
NewLineNumberRenderer creates a new line number renderer.
func (*LineNumberRenderer) Render ¶ added in v0.2.0
func (r *LineNumberRenderer) Render(width, height int, state *RenderState) []string
Render implements ColumnRenderer. Returns line numbers for visible lines, with the cursor line highlighted.
func (*LineNumberRenderer) SetStyles ¶ added in v0.2.0
func (r *LineNumberRenderer) SetStyles(styles Styles)
SetStyles updates the styles for runtime theme changes.
type MenuAction ¶
type MenuAction int
MenuAction represents an action triggered by a menu item
const ( ActionNone MenuAction = iota // File menu ActionNew ActionOpen ActionRecentFiles ActionRecentDirs ActionClose ActionSave ActionSaveAs ActionRevert ActionSetEncoding // Opens encoding selection dialog ActionExit // Edit menu ActionUndo ActionRedo ActionCut ActionCopy ActionPaste ActionCutLine ActionSelectAll // Search menu ActionFind ActionFindNext ActionReplace ActionGoToLine // Options menu ActionWordWrap ActionLineNumbers ActionSyntaxHighlight ActionScrollbar // Toggle scrollbar ActionMinimap // Toggle minimap ActionTheme // Opens theme selection dialog ActionKeybindings // Opens keybindings dialog ActionSettings // Opens settings dialog // Buffers menu ActionBuffer1 ActionBuffer2 ActionBuffer3 ActionBuffer4 ActionBuffer5 ActionBuffer6 ActionBuffer7 ActionBuffer8 ActionBuffer9 ActionBuffer10 ActionBuffer11 ActionBuffer12 ActionBuffer13 ActionBuffer14 ActionBuffer15 ActionBuffer16 ActionBuffer17 ActionBuffer18 ActionBuffer19 ActionBuffer20 // Help menu ActionHelp ActionAbout )
type MenuBar ¶
type MenuBar struct {
// contains filtered or unexported fields
}
MenuBar represents the top menu bar
func NewMenuBar ¶
NewMenuBar creates a new menu bar with default menus
func (*MenuBar) DropdownHeight ¶
DropdownHeight returns just the dropdown height (excluding the menu bar)
func (*MenuBar) HandleClick ¶
func (m *MenuBar) HandleClick(x, y int) (bool, MenuAction)
HandleClick handles a click at the given x position in the menu bar Returns true if the click was handled
func (*MenuBar) NextItem ¶
func (m *MenuBar) NextItem()
NextItem moves to the next item in the current menu
func (*MenuBar) PrevItem ¶
func (m *MenuBar) PrevItem()
PrevItem moves to the previous item in the current menu
func (*MenuBar) RenderDropdown ¶
RenderDropdown renders the dropdown menu as separate lines for overlay Returns the lines and the horizontal offset where the dropdown starts
func (*MenuBar) Select ¶
func (m *MenuBar) Select() MenuAction
Select returns the action of the currently selected item and closes the menu
func (*MenuBar) SelectByHotKey ¶
func (m *MenuBar) SelectByHotKey(key rune) MenuAction
SelectByHotKey finds an item by hotkey in the current menu and returns its action Returns ActionNone if no match or menu is not open
func (*MenuBar) SetBuffers ¶
SetBuffers updates the Buffers menu with current open buffers names is a list of buffer display names, activeIdx is the currently active buffer
func (*MenuBar) SetItemDisabled ¶
func (m *MenuBar) SetItemDisabled(action MenuAction, disabled bool)
SetItemDisabled sets the disabled state of a menu item by action
func (*MenuBar) SetItemLabel ¶
func (m *MenuBar) SetItemLabel(action MenuAction, label string)
SetItemLabel sets the label of a menu item by action
func (*MenuBar) UpdateShortcuts ¶ added in v0.2.0
func (m *MenuBar) UpdateShortcuts(kb *config.KeybindingsConfig)
UpdateShortcuts updates menu item shortcuts from keybindings config. This should be called after creating the menubar to reflect user's keybindings.
type MenuItem ¶
type MenuItem struct {
Label string
Shortcut string // Keyboard shortcut displayed (e.g., "Ctrl+S")
HotKey rune // Single letter hotkey when menu is open (e.g., 'S')
Action MenuAction
Disabled bool
}
MenuItem represents a single menu option
type MinimapController ¶ added in v0.2.0
type MinimapController interface {
ColumnRenderer
SetStyles(styles Styles)
SetEnabled(enabled bool)
IsEnabled() bool
Toggle() bool
GetMetrics(viewportHeight int, state *RenderState) MinimapMetrics
RowToVisualLine(row int, metrics MinimapMetrics) int
ClearImage() string // Returns escape sequence to clear graphics (Kitty only, empty for braille)
GetKittySequence(width, height, xOffset, yOffset int, state *RenderState) string // Kitty graphics overlay
}
MinimapController is an interface for minimap renderers. Both the braille-based MinimapRenderer and KittyMinimapRenderer implement this.
type MinimapMetrics ¶ added in v0.2.0
type MinimapMetrics struct {
TotalVisualLines int // Total visual lines in document
MinimapHeight int // Height of minimap in rows (ceil(visual lines / 4))
MinimapScrollOffset int // Current scroll offset of minimap view
ViewportHeight int // Height of viewport
}
MinimapMetrics holds metrics for mouse interaction with minimap.
type MinimapRenderer ¶ added in v0.2.0
type MinimapRenderer struct {
// contains filtered or unexported fields
}
MinimapRenderer renders a braille-based minimap of the document. Standard width is 8 (1 viewport indicator + 6 braille chars + 1 space).
=== MINIMAP SPECIFICATION (TODO: implement) ===
Vertical mapping:
- 1 braille dot row = 1 visual line (respects word wrap)
- Each braille character = 4 visual lines (braille has 4 dot rows)
- Minimap height = ceil(total visual lines / 4)
- Minimap may be shorter or taller than viewport - not scaled to fit
Horizontal mapping:
- 1 braille dot column = 5 source characters
- Each braille character = 10 source characters (2 dot columns × 5 chars)
- 6 braille characters = 60 source characters max
- Lines longer than 60 chars are truncated (not scaled)
Fill logic:
- A dot is ON if there are >= 3 non-whitespace characters in that 5-character span (i.e., less than 2 char widths of whitespace)
Viewport indicator:
- Option A: Current vertical bar │ on left side
- Option B: Reverse video on braille chars within viewport range
Mouse interaction:
- Clicking on minimap navigates viewport to that location
func NewMinimapRenderer ¶ added in v0.2.0
func NewMinimapRenderer(styles Styles) *MinimapRenderer
NewMinimapRenderer creates a new minimap renderer.
func (*MinimapRenderer) ClearImage ¶ added in v0.2.0
func (r *MinimapRenderer) ClearImage() string
ClearImage returns an empty string for braille renderer (no graphics to clear).
func (*MinimapRenderer) GetKittySequence ¶ added in v0.2.0
func (r *MinimapRenderer) GetKittySequence(width, height, xOffset, yOffset int, state *RenderState) string
GetKittySequence returns empty for braille renderer (no Kitty graphics).
func (*MinimapRenderer) GetMetrics ¶ added in v0.2.0
func (r *MinimapRenderer) GetMetrics(viewportHeight int, state *RenderState) MinimapMetrics
GetMetrics calculates minimap metrics for a given state.
func (*MinimapRenderer) IsEnabled ¶ added in v0.2.0
func (r *MinimapRenderer) IsEnabled() bool
IsEnabled returns whether the minimap is enabled.
func (*MinimapRenderer) Render ¶ added in v0.2.0
func (r *MinimapRenderer) Render(width, height int, state *RenderState) []string
Render implements ColumnRenderer. Returns braille representation of the document with viewport indicator.
func (*MinimapRenderer) RowToVisualLine ¶ added in v0.2.0
func (r *MinimapRenderer) RowToVisualLine(row int, metrics MinimapMetrics) int
RowToVisualLine converts a minimap row click to a visual line index. The row is relative to the viewport (0 = top of visible minimap area).
func (*MinimapRenderer) SetEnabled ¶ added in v0.2.0
func (r *MinimapRenderer) SetEnabled(enabled bool)
SetEnabled enables or disables the minimap.
func (*MinimapRenderer) SetStyles ¶ added in v0.2.0
func (r *MinimapRenderer) SetStyles(styles Styles)
SetStyles updates the styles for runtime theme changes.
func (*MinimapRenderer) Toggle ¶ added in v0.2.0
func (r *MinimapRenderer) Toggle() bool
Toggle toggles the minimap on/off.
type RenderState ¶ added in v0.2.0
type RenderState struct {
// Document content
Lines []string // All lines in the document
// Cursor position
CursorLine int
CursorCol int
// Scroll position
ScrollY int // First visible line (visual line for word wrap)
ScrollX int // Horizontal scroll offset
// Selection state (map of line index to selection range)
Selection map[int]SelectionRange
// Syntax highlighting (map of line index to color spans)
LineColors map[int][]syntax.ColorSpan
// Display options
WordWrap bool
TabWidth int // Display width of tabs
// Total document metrics (used by scrollbar, minimap)
TotalLines int // Total buffer lines
TotalVisualLines int // Total visual lines (with word wrap)
// Styles for rendering
Styles Styles
}
RenderState holds shared state passed to all column renderers. This allows columns to render consistently without direct coupling.
type Scrollbar ¶
type Scrollbar struct {
// contains filtered or unexported fields
}
Scrollbar represents a vertical scrollbar displayed on the right side of the editor
func NewScrollbar ¶
NewScrollbar creates a new scrollbar instance
func (*Scrollbar) Render ¶
Render renders the scrollbar as a slice of strings, one per viewport row viewportStart is the first visible line, viewportHeight is the number of visible lines, totalLines is the total number of lines in the document
func (*Scrollbar) RowToLine ¶
RowToLine converts a scrollbar row to the corresponding visual line index This is consistent with the thumb position calculation in Render
func (*Scrollbar) SetEnabled ¶
SetEnabled enables or disables the scrollbar
type ScrollbarColumnAdapter ¶ added in v0.2.0
type ScrollbarColumnAdapter struct {
// contains filtered or unexported fields
}
ScrollbarColumnAdapter wraps Scrollbar to implement ColumnRenderer.
func NewScrollbarColumnAdapter ¶ added in v0.2.0
func NewScrollbarColumnAdapter(sb *Scrollbar) *ScrollbarColumnAdapter
NewScrollbarColumnAdapter creates an adapter for the scrollbar.
func (*ScrollbarColumnAdapter) Render ¶ added in v0.2.0
func (a *ScrollbarColumnAdapter) Render(width, height int, state *RenderState) []string
Render implements ColumnRenderer interface.
type SelectionRange ¶
type SelectionRange struct {
Start int // Start column (inclusive)
End int // End column (exclusive), -1 for end of line
}
RenderLine renders a single line with optional selection highlighting
type StatusBar ¶
type StatusBar struct {
// contains filtered or unexported fields
}
StatusBar represents the bottom status bar
func NewStatusBar ¶
NewStatusBar creates a new status bar
func (*StatusBar) ClearMessage ¶
func (s *StatusBar) ClearMessage()
ClearMessage clears the temporary message
func (*StatusBar) SetBufferInfo ¶
SetBufferInfo sets the current buffer index and total buffer count
func (*StatusBar) SetEncoding ¶
SetEncoding sets the file encoding and whether it's supported
func (*StatusBar) SetFilename ¶
SetFilename sets the current filename
func (*StatusBar) SetMessage ¶
SetMessage sets a temporary message to display
func (*StatusBar) SetModified ¶
SetModified sets whether the buffer has been modified
func (*StatusBar) SetPosition ¶
SetPosition sets the cursor position (1-indexed for display)
func (*StatusBar) SetTotalLines ¶
SetTotalLines sets the total number of lines
type Styles ¶
type Styles struct {
// The theme these styles were generated from
Theme config.Theme
// Menu bar styles
MenuBar lipgloss.Style
MenuItem lipgloss.Style
MenuItemActive lipgloss.Style
MenuDropdown lipgloss.Style
MenuOption lipgloss.Style
MenuOptionActive lipgloss.Style
MenuOptionDisabled lipgloss.Style
// Status bar styles
StatusBar lipgloss.Style
StatusModified lipgloss.Style
// Editor styles
Editor lipgloss.Style
LineNumber lipgloss.Style
LineNumberActive lipgloss.Style
Selection lipgloss.Style
Cursor lipgloss.Style
// Dialog styles
DialogBox lipgloss.Style
DialogTitle lipgloss.Style
DialogText lipgloss.Style
DialogButton lipgloss.Style
DialogButtonFocus lipgloss.Style
DialogInput lipgloss.Style
DialogList lipgloss.Style
DialogListItem lipgloss.Style
DialogListActive lipgloss.Style
// General styles
Subtle lipgloss.Style
Error lipgloss.Style
}
Styles contains all the styles used in the editor
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles returns the default style configuration (DOS EDIT theme)
type TextRenderer ¶ added in v0.2.0
type TextRenderer struct {
// contains filtered or unexported fields
}
TextRenderer renders the main text content column. This is the flexible column that displays document content with syntax highlighting, cursor, and selection.
func NewTextRenderer ¶ added in v0.2.0
func NewTextRenderer(styles Styles) *TextRenderer
NewTextRenderer creates a new text renderer.
func (*TextRenderer) Render ¶ added in v0.2.0
func (r *TextRenderer) Render(width, height int, state *RenderState) []string
Render implements ColumnRenderer. Renders document text with syntax highlighting, cursor, and selection.
func (*TextRenderer) SetStyles ¶ added in v0.2.0
func (r *TextRenderer) SetStyles(styles Styles)
SetStyles updates the styles for runtime theme changes.
type Viewport ¶
type Viewport struct {
// contains filtered or unexported fields
}
Viewport handles the scrollable view of the text
func (*Viewport) CountVisualLines ¶
CountVisualLines returns the total number of visual lines when word wrap is enabled
func (*Viewport) EnsureCursorVisible ¶
EnsureCursorVisible scrolls the viewport to ensure the cursor is visible
func (*Viewport) EnsureCursorVisibleWrapped ¶
EnsureCursorVisibleWrapped scrolls the viewport to ensure cursor is visible (word-wrap aware) lines parameter is needed to calculate visual line positions
func (*Viewport) LineNumberWidth ¶
LineNumberWidth returns the width of the line number column
func (*Viewport) MoveDownVisual ¶
MoveDownVisual moves the cursor down by one visual line when word wrap is enabled. Returns the new line and column position.
func (*Viewport) MoveUpVisual ¶
MoveUpVisual moves the cursor up by one visual line when word wrap is enabled. Returns the new line and column position.
func (*Viewport) PageDownWrapped ¶
PageDownWrapped scrolls down by one page (word-wrap aware)
func (*Viewport) PositionFromClick ¶
PositionFromClick converts a click position to buffer line and column
func (*Viewport) PositionFromClickWrapped ¶
PositionFromClickWrapped converts a click position to buffer line and column (word-wrap aware)
func (*Viewport) Render ¶
func (v *Viewport) Render(lines []string, cursorLine, cursorCol int, selection map[int]SelectionRange, lineColors map[int][]syntax.ColorSpan) string
Render renders the visible portion of the text lineColors is an optional map of line index to color spans for syntax highlighting
func (*Viewport) ScrollDown ¶
ScrollDown scrolls the viewport down by one line
func (*Viewport) ScrollDownWrapped ¶
ScrollDownWrapped scrolls the viewport down (word-wrap aware)
func (*Viewport) ScrollUp ¶
func (v *Viewport) ScrollUp()
ScrollUp scrolls the viewport up by one line
func (*Viewport) ScrollbarWidth ¶
ScrollbarWidth returns the width reserved for the scrollbar
func (*Viewport) SetScrollX ¶
SetScrollX sets the horizontal scroll position
func (*Viewport) SetScrollY ¶
SetScrollY sets the vertical scroll position
func (*Viewport) SetScrollbarWidth ¶
SetScrollbarWidth sets the width reserved for the scrollbar
func (*Viewport) SetTabWidth ¶ added in v0.2.0
SetTabWidth sets the display width for tabs
func (*Viewport) SetWordWrap ¶
SetWordWrap enables or disables word wrap
func (*Viewport) ShowLineNum ¶
ShowLineNum returns whether line numbers are enabled
func (*Viewport) ShowLineNumbers ¶
ShowLineNumbers enables or disables line numbers
func (*Viewport) TextWidth ¶
TextWidth returns the width available for text (viewport width minus line numbers and scrollbar)