# 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 ```bash 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>`) 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