Files
redactor/CLAUDE.md
Kyle Isom 963fcc6458 Embed fonts from repo instead of ~/.local/share/fonts
Move BrassMono font files into fonts/ and use a repo-relative
include_bytes! path so the build is self-contained. Add CLAUDE.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:15:48 -07:00

1.6 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project

Redactor is a two-pane text redaction GUI built in Rust with eframe/egui. Users paste text in the left panel, select regions and press Ctrl+R to toggle redaction, and the right panel shows a live preview with redacted regions replaced by block characters (U+2588). The entire application lives in src/main.rs.

Build & Run

cargo build              # debug build
cargo build --release    # release build
cargo run                # run the app

Nix flake provides the dev environment (Rust toolchain + native deps for egui). Direnv auto-loads it via .envrc.

Architecture

All logic is in src/main.rs (~490 lines) in the RedactorApp struct:

  • State: source text (String) + sorted non-overlapping byte ranges (Vec<Range<usize>>) of redactions
  • Left panel: editable TextEdit with redacted regions highlighted via LayoutJob text formatting
  • Right panel: read-only preview where redacted bytes become full-block characters, preserving whitespace
  • Reconciliation: when source text is edited, reconcile_redactions adjusts byte ranges by detecting unchanged prefix/suffix regions
  • Range operations: add_redaction merges overlapping ranges; remove_redaction splits ranges; all operations snap to UTF-8 character boundaries

UI

  • Nord color palette (dark theme) with BrassMonoCode monospace font (bundled .ttf files, embedded at compile time)
  • Keyboard: Ctrl+R toggles redaction on selection, Cmd+Q quits
  • Toolbar has keyboard help and "Copy Redacted" button