18. Text and Source Viewing and Editing
Text and Source Viewing and Editing requirements from the authoritative Glitchpad Technical Specification.
The text renderer provides a lightweight editor, not an IDE. It includes line numbers, selectable wrapping, find and replace, go-to-line, undo/redo, multi-selection supplied by CodeMirror, indentation commands, encoding and newline status, syntax highlighting, and explicit language override.
Language detection uses exact filename, extension, shebang, modeline, and bounded content evidence. CodeMirror language packages load only when selected. Unknown text opens as plain text. A user override affects the session; persistent extension overrides require an explicit preference action.
Mermaid source mode is a specialized text language mode. It adds diagram diagnostics and preview navigation but MUST NOT acquire language-server, execution, workspace, or visual-source-generation behavior.
The renderer MUST NOT implement language servers, compilers, build commands, debugging, terminals, project search, project symbols, package management, repository operations, AI completion, or IDE refactoring.
Files through 32 MiB support full editing and syntax highlighting subject to line limits. Files from 32 MiB through 256 MiB open in virtualized large-text read-only mode with search and copy; syntax highlighting is disabled. Files above 256 MiB are refused with size and alternative-tool guidance. A single line above 2 MiB disables syntax parsing for that document and remains viewable in plain-text mode.