Skip to content

Latest commit

 

History

History
354 lines (315 loc) · 38.8 KB

File metadata and controls

354 lines (315 loc) · 38.8 KB

Documentation Index

Core Context


Technical Documentation

Configuration & Setup

Document Description
Project Setup Initial project configuration, dependencies, and build setup
Error Handling Centralized error system, Result type, logging, graceful degradation
Settings & Config Settings struct, serialization, validation, sanitization
Config Persistence Platform-specific config storage, load/save functions, fallback handling
Log Level Config Configurable log verbosity via config.json and --log-level CLI flag
Internationalization rust-i18n integration, Language enum, translation keys, adding languages
Multi-Encoding Support Character encoding detection (chardetng), manual selection, save in original encoding
Snippets System Text expansion system with built-in date/time snippets and custom user snippets
New File Save Prompt Skip save prompt for unmodified untitled files, should_prompt_to_save(&Settings) logic
Quick note workflow Ephemeral untitled tabs: on by default (no-prompt quit; tab close still prompts); turn off in Settings; session recovery; rename
Default View Mode Per-file-type default view mode configuration
Code execution settings Opt-in prefs for markdown code-block runners (timeout, shell/Python gates)

Editor Core

Document Description
Architecture REQUIRED READING: Core principles, complexity tiers, memory budget, anti-patterns
FerriteEditor Custom editor widget: TextBuffer, ViewState, LineCache; undo via Tab::edit_history
TextBuffer Rope-based text buffer for O(log n) editing operations on large files
EditHistory Operation-based undo/redo for memory-efficient large file editing
ViewState Viewport tracking and visible line range calculation for virtual scrolling
LineCache LRU-cached galley storage for efficient text rendering without recreation each frame
LineCache Smart Invalidation Targeted range invalidation and dynamic cache sizing for large-file editing performance
Large File Performance Per-frame optimizations for 5MB+ files; open-time warning toast for 10MB+
Memory Optimization Tab closure cleanup, FerriteEditorStorage management, debug vs release performance
Word Wrap Phase 2 word wrap support: visual row tracking, wrapped galley caching, cursor navigation
Editor Widget Text editor widget, cursor tracking, scroll persistence, egui TextEdit integration
Line Numbers & Gutter Gutter system with toggleable line numbers and fold indicators, dynamic width calculation
Line Number Alignment Technical fix for line number drift, galley-based positioning
Cursor Position Mapping Raw-to-displayed text position mapping for formatted content editing
Galley Cursor Positioning Pixel-accurate cursor placement using egui Galley text layout
Undo/Redo System Per-tab undo/redo with keyboard shortcuts (Ctrl+Z, Ctrl+Y)
Undo Hash Change Detection Blake3 hash-based undo snapshot to eliminate per-frame content clones
Find and Replace Search functionality with regex, match highlighting, replace operations
Go to Line Ctrl+G modal dialog for line navigation, viewport centering
Duplicate Line Ctrl+Shift+D line/selection duplication, char-to-byte index handling
Move Line Alt+Up/Down line reordering, pre-render key consumption, cursor following
Code Folding Fold region detection, gutter indicators, content hiding
Code Folding UI Code folding user interface and interactions
Multi-Cursor Editing Multiple cursor support with Ctrl+Click, simultaneous editing, selection merging
Semantic Minimap Semantic minimap with clickable heading labels, content type indicators, density bars
Editor Minimap (Legacy) VS Code-style pixel minimap (replaced by semantic minimap)
Search Highlight Search-in-files result navigation with transient highlight, auto Raw mode switch
Search Highlight Rendered View Rendered view search highlights (incl. tables) and floating panel z-order stacking
Search Highlight Edit Recompute Fix stale search highlights after document edits by recomputing match positions
Syntax Highlighting Syntect integration for code block highlighting
Auto-close Brackets Auto-pair insertion, selection wrapping, skip-over behavior for brackets/quotes
Bracket Matching Highlight matching brackets and parentheses
Vim Mode Optional modal editing with Normal/Insert/Visual modes, Vim keybindings
Windows IME layer transform IMEOutput in screen space via layer TSTransform (candidate box alignment)
Word Wrap Scroll Fixes Correctness fixes for pixel_to_line, line_to_pixel, scroll sync when word wrap active
Word Wrap Performance Incremental height cache, O(1) LRU, O(log N) visual row mapping
Ctrl+Scroll Zoom Ctrl+Mouse Wheel zoom mapped to egui::gui_zoom, ZoomIn/ZoomOut/ResetZoom shortcuts
Font System Custom font loading, EditorFont enum, bold/italic variants, CJK/complex script lazy loading
HarfRust text shaping harfrust 0.5.2 OTL shaping: cluster grouping, shaped-line cache, per-cluster rendering
Grapheme-Cluster Cursor Grapheme-cluster-aware arrow keys, backspace, delete for emoji ZWJ, Bengali, Korean
Uniform Height Large Files Uniform line heights for 100K+ line files: O(1) memory, force-disabled word wrap
Custom Font Selection System font enumeration, custom font picker, CJK regional preferences
Complex Script Font Preferences Per-script font preferences for Arabic, Bengali, Devanagari, Thai, Hebrew, Tamil, etc.
CJK Font Preloading Verification Verification that explicit CJK preferences preload correctly at startup
Custom Font Crash Prevention Magic-byte validation, catch_unwind, graceful fallback for invalid custom fonts
Custom font picker deferred load Custom mode waits for an explicit combo pick before loading; fixes macOS #133 toast

UI Components

Document Description
Ribbon UI Modern ribbon interface replacing menu bar, icon-based controls
Ribbon Redesign Design C streamlined ribbon, title bar integration, dropdown menus
Special Tabs Tab-based UI panels (Settings, About/Help) replacing modal windows
Settings Panel Settings UI in a special tab, live preview, appearance/editor/files/keyboard/terminal sections
Outline Panel Document outline side panel, heading extraction, statistics for structured files
Backlinks Panel Backlinks panel showing files linking to current file, adaptive indexing, click-to-navigate
Status Bar Bottom status bar with file path, stats, toast messages
About/Help Panel About/Help in a special tab, version info, keyboard shortcuts reference
Zen Mode Distraction-free writing mode, centered text column, chrome hiding, F11 toggle
Split View Side-by-side raw editor + rendered preview, draggable splitter, independent scrolling
Search Panel Viewport Viewport constraints for Search panel, DPI handling, resize behavior
Quick Switcher Mouse Support Mouse hover/click fix with layer-based background, interaction overlay
Command Palette Alt+Space searchable command launcher with fuzzy search, recent commands, deferred dispatch
Keyboard Shortcuts Global shortcuts for file ops, tab navigation, deferred action pattern
Keyboard Shortcut Customization Settings panel for rebinding shortcuts with conflict detection, persistence
Light Mode Contrast WCAG AA color tokens, contrast ratios, border/text improvements
Light Mode Strong Text Fix Fix invisible RichText::strong() labels in light mode
Theme System Light/dark/System themes, ThemeManager, user-configurable Ferrite accent (headings, selection, chrome; links stay classic blue)
Adaptive Toolbar File-type aware toolbar, conditional buttons for Markdown vs JSON/YAML/TOML
Navigation Buttons Document navigation overlay for quick jumping to top, middle, or bottom
Frontmatter Panel Visual YAML frontmatter editor, form-based key-value editing, tag chips, bidirectional sync
Header Spacing Adjustable vertical spacing between headings (H1-H6) in rendered view
Check for Updates Manual update checker via GitHub Releases API, security model, URL validation

Markdown & WYSIWYG

Document Description
Markdown Parser Comrak integration, AST parsing, GFM support
WYSIWYG Editor WYSIWYG markdown editing widget, source synchronization, theming
WYSIWYG Interactions WYSIWYG user interaction patterns and behaviors
Editable Widgets Standalone editable widgets for headings, paragraphs, lists
Editable Code Blocks Syntax-highlighted code blocks with edit mode, language selection
Code block Run Run control in rendered/split preview: background worker, ANSI inline output (CRLF-safe on Windows), ✓/✗ exit, insert-as-fenced-block, Stop + hard timeout; § Known limitations + link to manual test file
Code execution consent dialog First-run modal when clicking Run before consent; queues payload; Settings toggle skips modal
Code block Run cancellation & timeout RunStatus::Cancelled, atomic cancel token, Stop button, Timed out after Ns / Stopped by user labels, reader-thread shutdown
Editable Links Hover-based link editing with popup menu, autolink support
Editable Tables GFM table editing, deferred commits, toolbar, markdown sync
Table cell focus & navigation Empty-cell hit targets, Tab / Shift+Tab in-table (lock_focus, consume order)
Click-to-Edit Formatting Hybrid editing for formatted list items and paragraphs (superseded — see Rendered edit session: formatted blocks)
Rendered edit session (overview) Architecture hub: motivation, source_epoch, BlockRef, session API, commit policy, RS-1…RS-7 / TBLE matrix, design decisions
Rendered edit session (Phase 0) Formatted blur hotfix + Tab::source_epoch; foundation before full session coordinator
Rendered edit session (core types) BlockRef, RenderedEditSession state machine and tab-scoped egui storage
Rendered edit session (headings) Headings wired to session: switch_to_ui, buffer commit, one-click cross-heading switch
Rendered edit session (paragraphs & lists) Plain paragraphs and simple list items on session; epoch invalidation; cross-block switch with headings
Rendered edit session (formatted blocks) Formatted paragraphs and list items on session: click-to-edit, display→raw cursor mapping, Enter/Escape; replaces FormattedItemEditState and formatted_exit_should_save
Rendered edit session (tables) BlockRef::TableCell activation + signal_table_force_commit one-shot signal: cross-block exit commits the table; intra-table Tab navigation preserves deferred commits
Rendered edit session (split view) rendered_editor_id(tab.id) shared by rendered-only and split preview; raw-pane epoch bumps invalidate session buffers (RS-6)
Rendered edit session (undo) One logical undo step per block commit; session keystrokes stay off the undo stack until close/switch
Rendered widget identity ui.push_id(editor_id + source_epoch) for stable TextEdit ids; content_hash for culling only
Formatting Toolbar Markdown formatting toolbar, keyboard shortcuts, selection handling
Emphasis Rendering Bold, italic, strikethrough rendering in WYSIWYG
Table of Contents TOC generation from headings, anchor links, update/insert modes
Mermaid insert toolbar Format toolbar combo: insert fenced Mermaid templates at cursor (Raw / Split)
Mermaid syntax help About / Help (F1) tab: per-diagram descriptions and snippets aligned with Insert → Mermaid…
List Editing Fixes Frontmatter offset fix, edit buffer persistence, deferred commits, rendered-mode undo/redo
List Editing Debug Debugging list editing issues and fixes
Task List Checkbox Interactive task list checkboxes in rendered view; click-to-toggle with source sync; scroll-stable via structure-preserving culling
Table Editing Focus Fix cursor loss during table cell editing, deferred source updates
Smart Paste URL detection, markdown link creation with selection, image markdown insertion
Image Drag & Drop Drag images into editor, auto-save to assets/, insert markdown link
CJK Paragraph Indentation First-line paragraph indentation for Chinese (2em) and Japanese (1em)
Block Element Alignment Consistent 4px left indent for tables, code blocks, blockquotes
GitHub-Style Callouts GitHub-style callouts with color-coded rendering, collapse toggle
Wikilinks [[target]] syntax, file resolution, click-to-navigate, broken link indicators
Image Rendering Local image display in rendered/split view, path resolution, texture caching
Setext Heading Detection Single-dash false setext fix, backwards-scan underline detection
Markdown AST Caching Blake3 content-hash AST cache to skip re-parsing unchanged markdown
Rendered View Viewport Culling show_viewport() two-phase culling with 500px overscan for large-document performance
Block-Level Height Cache Per-block blake3-keyed LRU height cache for off-screen block measurement skip
Consecutive Fenced Blocks Fix issue #129 — horizontal ScrollArea auto_shrink_y fix so consecutive fenced blocks all stay visible
Strict Line Breaks Optional setting treating single newlines as hard <br> breaks
Lazy Block Height Estimation Heuristic heights for unmeasured blocks, render budget cap, progressive refinement
Paragraph Trailing Spaces Fix for trailing spaces lost in plain paragraphs via persistent edit buffer
Rendered Paragraph Block Spacing Trailing space after block paragraphs and code blocks; viewport height alignment
Table Inline Formatting Preserve and render bold, italic, strikethrough, code in table cells (serialization + rich text display)
Video embed parsing {{video URL}} and bare YouTube paragraph syntax; VideoEmbed AST node, allowlist, round-trip source_text

Data Viewers

Document Description
CSV Viewer CSV/TSV table viewer with scrolling, header highlighting, cell tooltips
CSV Lazy Parsing Byte-offset row indexing for large CSVs, on-demand visible-row parsing
CSV Delimiter Detection Auto-detect delimiter (comma/tab/semicolon/pipe), manual override
CSV Header Detection Auto-detect header rows with heuristics, toggle UI, column alignment
CSV Rainbow Columns Subtle alternating column colors using Oklch, status bar toggle
CSV Raw View Caching Blake3 hash-guarded raw text cache to eliminate per-frame string allocation
Image Viewer Dedicated image viewer tabs (PNG/JPEG/GIF/WebP/BMP) with zoom and metadata
PDF Viewer Read-only PDF viewer tabs with hayro rendering, page navigation, zoom
Print preview Same render_markdown_to_pdf as Export PDF; temp file → PdfViewer tab; ephemeral session/temp cleanup
Tree Viewer JSON/YAML/TOML tree viewer with inline editing, expand/collapse, path copying
Tree Viewer Caching Blake3-guarded parse cache and raw text buffer to avoid per-frame work
Live Pipeline JSON/YAML command piping through shell commands (jq, yq), recent history
Document Export Themed HTML export (options dialog, Mermaid SVG, syntect blocks), clipboard HTML, PDF export pointer
Themed HTML export Implementation map: comrak adapter, Mermaid SVG, theme resolution, image/link post-process
PDF Export v0.3.x: Native-Rust PDF export via krilla (fonts, page size/margins, H1 page-break dialog, link annotations)

File Operations & Workspaces

Document Description
File Dialogs Native file dialogs with rfd, open/save operations
Tab System Tab data structure, tab bar UI, close buttons, unsaved changes dialog
Recent Files Recent files menu in status bar
Workspace Folder Support Folder workspace mode, file tree, quick switcher, search in files, file watching
Workspace File Index Background full-tree index for Ctrl+P and Ctrl+Shift+F (independent of lazy file tree)
Session Persistence Crash-safe session state, tab restoration, recovery dialog, lock file mechanism
Auto-Save Configurable auto-save with temp file backups, toolbar toggle, recovery dialog
Git Integration Branch display in status bar, file tree Git status badges, git2 integration
Git Auto-Refresh Automatic git status refresh on save, focus, and periodic intervals

Terminal Emulator

Document Description
Terminal Architecture Integrated terminal with PTY (portable-pty), VTE parsing, screen buffer, ANSI color
Terminal UI Terminal panel with tabs, split panes, floating windows, drag-and-drop
Terminal Themes Terminal color schemes (Solarized, Dracula, Monokai, Nord, etc.)
Terminal Layout Split pane layouts (horizontal/vertical), grid creation, layout save/load
Terminal CJK Wide Chars Double-width CJK character rendering, cursor advancement, selection snapping

Productivity Hub

Document Description
Productivity Panel Task management, Pomodoro timer, quick notes with workspace-scoped persistence

Async Workers

Document Description
Worker Infrastructure Background tokio runtime, channel-based UI communication, worker pattern

Platform-Specific

Document Description
eframe Window Window lifecycle, dynamic titles, responsive layout, state persistence
eframe/egui 0.31 Upgrade v0.3.0 GUI stack bump from 0.28 → 0.31.1 — breaking API migration patterns and validation
eframe/egui 0.34 Upgrade v0.3.0 GUI stack bump to 0.34.2 — viewport rects, Popup API, skrifa/HarfRust, MSRV 1.92
v0.3.0 Cross-Platform Regression Matrix Manual regression matrix for v0.3.0 (egui 0.31 + 0.34 delta, Task 89 §8)
Custom Title Bar Windows-style custom title bar implementation
Window Resize Custom resize handles for borderless windows, edge detection
Windows Borderless Window Top edge resize fix, fullscreen toggle (F10), title bar button area exclusion
Windows Borderless Transparent Fix Fix rendering offset (black bars) on Intel GPUs via with_transparent(true) DWM workaround
Windows Path Normalization Strip Windows \\?\ prefix from canonicalized paths
Linux Cursor Flicker Fix Title bar exclusion zone to prevent cursor conflicts with window controls
Idle Mode Optimization Tiered idle repaint system to reduce CPU usage on all platforms
SignPath Code Signing Windows code signing via SignPath for OSS
Single-Instance Protocol Lock file + TCP IPC to open files in existing window
macOS .app Bundle CI CI workflow for proper macOS .app bundle packaging
macOS Gatekeeper (GitHub Releases) Unsigned CI artifacts, doc map (#130), release checklist
macOS Markdown file association UTI for .md files, Finder Open With / default app
macOS Intel CPU Optimization Idle repaint optimization to reduce CPU usage on Intel Macs
Intel Mac Repaint Investigation Investigation into continuous repaint issues on Intel Macs
Intel Mac CPU Analysis Analysis of CPU usage issues on Intel Mac hardware
MSI Installer Features Windows MSI feature tree: file associations, context menu, PATH, desktop shortcut
Linux Portal Dialogs xdg-desktop-portal requirements for Hyprland, Sway, and minimal WMs
Linux Cinnamon Dialogs X-Cinnamon desktop detection, xapp/gtk portal instructions, cancellation fix
Flatpak File Dialog Portal Open Folder/File/Save dialogs in Flatpak via xdg-desktop-portal

Distribution & Packaging

Document Description
Flathub Maintenance How to maintain and update Ferrite on Flathub (release checklist, moderation)
Linux Package Distribution Plan Plan for distributing Ferrite via Flathub, Snap, AUR, and native packages
Nix Flake Official Nix flake for reproducible builds, dev shells, NixOS/Home Manager

Mermaid Diagrams

Document Description
Mermaid Diagrams MermaidJS code block detection, diagram type indicators, styled rendering
Mermaid Text Measurement TextMeasurer trait, dynamic node sizing, egui font metrics integration
Mermaid Modular Structure Modular directory layout for diagram types, TextMeasurer trait, shared utilities
Mermaid Edge Parsing Chained edge parsing fix, arrow pattern matching, label extraction
Mermaid classDef Styling Node styling with classDef/class directives, hex color parsing
Mermaid YAML Frontmatter YAML frontmatter support for diagram titles, config parsing
Mermaid Caching AST and layout caching for flowcharts, blake3 hashing, LRU eviction
Flowchart Layout Algorithm Sugiyama-style layered graph layout: cycle detection, crossing reduction, alone-on-layer branch-parent snap, resolve_layer_overlaps sibling-spacing safety net (v0.3.0)
Flowchart Subgraphs Flowchart subgraph support, nested parsing, bounding box computation
Flowchart Direction Flow direction layout (LR/RL/TD/BT), axis transformation, edge anchoring
Flowchart Branch Ordering Decision node branch positioning, edge declaration order, barycenter algorithm
Flowchart Subgraph Title Subgraph title width expansion, preventing title truncation
Flowchart Asymmetric Shape Asymmetric (flag) shape rendering, text centering
Flowchart shapes & style Trapezoid, double circle, style nodeId, color: in classDef, merge precedence
Flowchart Viewport Clipping Viewport clipping fix, negative coordinate shifting
Flowchart linkStyle Edge styling via linkStyle directive, stroke color/width customization
Flowchart Crash Prevention Infinite loop safety, panic handling, graceful degradation
Subgraph Layer Clustering Subgraph-aware layer assignment, consecutive layer clustering
Subgraph Internal Layout Subgraph internal positioning, SubgraphLayoutEngine, bounding box computation
Subgraph Edge Routing Edge routing through subgraph boundaries, orthogonal waypoints
Flowchart edge obstacle routing v0.3.0 FC-83a: forward-edge obstacle avoidance, painter sized from real node bounds, fixed-margin back-edge side channels, parallel back-edge lanes (E→B / F→B), inner back-edge top-corner up-first direct path
Nested Subgraph Layout Nested subgraph margins, depth calculation, direction overrides
Sequence Control Blocks Sequence diagram loop/alt/opt/par blocks, nested parsing, block rendering
Sequence Activations & Notes Activation boxes, notes, +/- shorthand, state tracking
State Composite Nested State diagram composite and nested state support
State pseudostates (fork/join/history) <<fork>> / <<join>> bars and [H] / [H*] history glyphs in native state diagrams
Flowchart Modular Refactor Flowchart.rs split into 12 focused modules (types, parser, layout/, render/, utils)
Flowchart Refactor Plan Original analysis and refactoring plan for flowchart.rs modularization
Mermaid Inline Validation Parse-time validation: warning header (line + hint), last-good fallback, raw-editor squiggles for broken mermaid blocks
Mermaid Parity Matrix Feature/status map vs Mermaid.js, GitHub issue cross-ref, repro catalog, pre-0.3.0 rendering backlog

LSP Integration (deferred to v0.2.9 — feature-gated behind lsp Cargo feature)

Document Description
LSP Integration Plan Planning: Language Server Protocol client (diagnostics, hover, go-to-def)
LSP Module Infrastructure src/lsp/ — LspManager, stdio transport, extension-to-server detection
LSP Server Lifecycle Auto-detect/spawn servers, crash restart with backoff, clean shutdown
LSP Windows — No Console CREATE_NO_WINDOW on LSP Command spawn to prevent cmd.exe flash
LSP Status & Overrides Status bar per-server state, lsp_server_overrides, Editor settings UI
LSP On-Demand Startup Lazy server spawn on tab activation, idle shutdown, didClose on tab close
LSP Inline Diagnostics Inline squiggles (error/warning), hover tooltips, didOpen/didChange sync

Planning & Roadmap

Document Description
Custom Editor Widget Plan v0.3.0 planning: Replace egui TextEdit with custom FerriteEditor widget
Memory Optimization Plan v0.2.6 planning: Reduce idle RAM from ~250MB to ~100-150MB
Custom Memory Allocator Platform-specific allocators (mimalloc/jemalloc) for reduced fragmentation
egui Memory Cleanup Clean up rendered editor temp data in egui memory on tab close
Viewer State Cleanup Memory leak fix: cleanup viewer state HashMaps on tab close
Dead Code Cleanup Task 39 cleanup summary, removed code, module changes
app.rs Refactoring Plan Split 7,634-line app.rs into ~15 focused modules under src/app/
Mermaid Crate Plan Extract Mermaid renderer as standalone pure-Rust crate
Math Support Plan v0.4.0 planning: Native LaTeX/TeX math rendering (pure Rust)
PDF Export Pipeline v0.3.x decision doc: native-Rust PDF export via krilla + krilla-svg, browser fallback retained

Performance

Document Description
Per-Frame Cache Elimination content_version-based caching to eliminate 7 O(N) per-frame operations for large files
Background File Loading Background thread loading for 5MB+ files with progress bar, cancellation support

Core (Remaining)

Document Description
App State AppState, Tab, UiState structs, undo/redo, event handling
View Mode Persistence Per-tab view mode storage, session restoration, backward compatibility
Document Statistics Statistics panel tab with word count, reading time, heading/link/image counts
Text Statistics Word, character, line counting for status bar
Sync Scrolling Split-view live sync (minimap Sync / 2-way), per-pane scroll delivery, Ctrl+E mode-toggle preservation, content anchors
Configurable Line Width MaxLineWidth setting (Off/80/100/120/Custom), text centering in all views
Branding Icon design, asset generation, platform integration guidelines

Guides

Guide Description
macOS install & Gatekeeper Unsigned CI bundles, macOS 15.x / Sequoia, xattr quarantine removal, Open Anyway workarounds
GitHub Release checklist Pre-tag, GitHub Release, Flathub, and Nix steps; macOS Gatekeeper blurb (#130)
Adding Languages How to add new translations, translation portal setup, contributor workflow
Translation Status Assessment List of user-facing strings not yet using i18n, for Weblate extraction
v0.2.6 Test Suite Manual testing checklist for FerriteEditor release
v0.2.8 Test Suite Manual testing checklist for v0.2.8 release
v0.3.0 Test Suite Pre-merge manual checklist for v0.3.0 (Tasks 90–106, rendered session, session recovery)