Documentation
¶
Overview ¶
Package syntax highlights source files for display in the TUI source pane.
A curated Chroma tokeniser is compiled in only for the default build. The `lite` build tag swaps in a small built-in highlighter (highlight_lite.go), dropping Chroma while keeping basic source colours.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HighlightLines ¶
HighlightLines returns ANSI-styled source lines without using a cache. It uses the minimal highlighter when Chroma cannot identify or tokenise the file.
func StyleEntryToLipgloss ¶
func StyleEntryToLipgloss(e chroma.StyleEntry, fallbackFG string) lipgloss.Style
StyleEntryToLipgloss converts the subset of Chroma style attributes exex renders. Tokens a style leaves uncoloured take fallbackFG (see theme.ForegroundFor), so a style that only highlights keywords still draws its body text in the right colour instead of the terminal default.
Both the source pane (this package) and the disassembly pane (internal/ui) need it, and each had its own byte-identical copy.
Types ¶
type Highlighter ¶
type Highlighter struct {
// contains filtered or unexported fields
}
Highlighter tokenises source files and caches recent per-line ANSI output.
func NewHighlighter ¶
func NewHighlighter(theme string) *Highlighter
NewHighlighter creates a cached source highlighter. An empty theme selects the project default.