replace_in_buffer calls buf.begin_undo_group()/end_undo_group() but Buffer::from_str() doesn't prime undo snapshots. Undo requires a pre-existing edit in the undo stack. This is a Buffer design issue, not a replace module bug. 1469 tests pass, 0 fail, 1 ignored (known limitation).
Twilight Commander (tlc) — Red Bear OS
TLC is Red Bear's internal TUI file manager, originally derived from Midnight Commander (MC) 4.8.33, but now architecturally and implementation-wise pure Rust, no FFI, no C compilation.
Status
TLC's source tree is TLC's own. It was derived from MC 4.8.33 once and
fully rewritten in Rust — every Rust module, every Rust function, every
Rust test is original Red Bear code. The C source of MC 4.8.33 lives in
the canonical MC recipe at local/recipes/tui/mc/source/ and serves as
read-only cross-reference for algorithm correctness.
TLC and MC are two separate, completely independent programs.
Name
Originally tc (Twilight Commander). Renamed to tlc on 2026-06-13 to
avoid collision with iproute2's /usr/bin/tc traffic-control binary and
the third-party tc crate on crates.io. "TLC" is intentionally a
double reading: Twilight List-and-Copy (the function) and
Tender Loving Care (the ethos).
Architecture
local/recipes/tui/tlc/
├── PLAN.md ← canonical plan, phase status, quality assessment
├── recipe.toml ← cookbook recipe (custom template, cargo build)
└── source/ ← PURE RUST — 113 .rs files, 46k+ lines
├── Cargo.toml ← [package] name = "tlc"
├── config/default.toml
├── locales/*.yml ← rust-i18n catalogues
└── src/ ← app, config, editor, filemanager, fs, key,
keymap, locale, log, ops, paths, skin,
terminal, text, vfs, viewer, widget
The recipe builds three binaries — tlc (file manager),
tlcedit (standalone editor), and tlcview (standalone viewer) —
and stages them at /usr/bin/ in the Red Bear OS image. tlc is
registered in both redbear-mini.toml and redbear-full.toml configs
as tlc = {}.
Why pure Rust, no FFI
termionprovides everything MC's tty layer didratatuiprovides everything MC's widget layer did- FFI adds
unsafe, which project policy forbids - Pure Rust code is auditable and deterministic
Build
Linux (host build, zero setup)
TLC is pure portable Rust — it builds and runs natively on Linux with no Redox-specific code or dependencies.
cd local/recipes/tui/tlc/source
cargo build --release # tlc (5.0 MB), tlcedit (1.2 MB), tlcview (661 KB)
./target/release/tlc --version # tlc 0.2.5
./target/release/tlc # launch file manager TUI
./target/release/tlcedit file.txt # launch standalone editor
./target/release/tlcview file.txt # launch standalone viewer
./target/release/tlc help # list keybindings
Redox (cross build for ISO)
cd local/recipes/tui/tlc/source
cargo build --release --target x86_64-unknown-redox
# Full ISO with TLC installed
./local/scripts/build-redbear.sh redbear-mini # includes /usr/bin/tlc
./local/scripts/build-redbear.sh redbear-full # includes /usr/bin/tlc
# Single recipe via cookbook
./target/release/repo cook local/recipes/tui/tlc
Test
cd local/recipes/tui/tlc/source
cargo test --lib
# → 1213 passed; 0 failed (verified 2026-07-05)
Linux Portability
TLC is designed as a pure-Rust portable application. It uses:
std::fsabstractions for all filesystem operationscfg(unix)gates for platform-specific behavior (stat, permissions)ratatui+termionfor terminal rendering (works on any Unix tty)- No
target_os = "redox"ortarget_os = "linux"gates anywhere
The redox Cargo feature and redox-scheme dependency were removed
(declared but never consumed — no source file used #[cfg(feature = "redox")]). TLC is the same binary on Linux and Redox.
Shared TUI palette
TLC's src/terminal/color.rs consumes the shared Red Bear TUI palette
from local/recipes/tui/redbear-tui-theme/ (a Red Bear-internal
library crate). The 23-field Theme struct in terminal/color.rs is
preserved (it deserializes user TOML skins), but the DEFAULT_THEME
and LIGHT_THEME constants are now built from the shared
REDBEAR_DARK / REDBEAR_LIGHT presets via a const as_color(rgb)
adapter.
All rendering code (widgets, dialogs, editor, viewer, file panels)
sources colors exclusively from the Theme palette — no hardcoded
Color::White/Color::Blue/etc. remain in any render path. Every
render() method accepts a theme: &Theme parameter. User TOML skins
with any of the 23 palette slots are fully functional via
Skin::to_theme().
The brand red is #B52430 — the same red as the Red Bear OS icon, the
loading background, the cub RedBearTheme::accent (when cub migrates),
and every other TUI app that adopts the shared palette.
See local/recipes/tui/redbear-tui-theme/README.md for the full
palette, contrast table, and migration guide.
Built-in skins
TLC ships with 8 built-in skins accessible via Alt-S at runtime:
| Skin | Description |
|---|---|
default-dark |
Red Bear Dark (brand palette, default) |
default-light |
Red Bear Light |
mc-classic |
Midnight Commander Classic (blue/cyan) |
mc-dark |
MC Dark — gray panels, bright accents |
mc-dark-gray |
MC Dark Gray — near-black, desaturated |
high-contrast |
Black/white, WCAG-maximum |
solarized-dark |
Solarized Dark palette |
nord |
Nord palette |
User TOML skins in ~/.config/tlc/skin/*.toml are also listed in the
dialog. Selection persists to ~/.config/tlc/config.toml.
Phase status
| Phase | Status |
|---|---|
| 0 ops dialogs | ✅ |
| 1 dual-panel shell | ✅ |
| 2 F3 viewer | ✅ |
| 3 F4 editor | ✅ |
| 4 keymap + dispatcher | ✅ |
| 5 editor polish | ✅ |
| 6 filemanager + viewer extras | ✅ |
| 7 VFS (local + remote backends) | ✅ SFTP full read-write, FTP, scheme:// (Redox), tar/cpio/zip/extfs |
| 8 archives + skin + i18n | ✅ browse+extract+compress (Alt-Shift-C), 8 skins, i18n |
| 13 skins + runtime selection | ✅ 8 built-in skins, Alt-S dialog, config persistence |
| 14a critical features | ✅ menu bar (F9), select/unselect group, quick cd, Ctrl-O sub-shell, Alt-Enter cmdline |
| 14b bug fixes | ✅ viewer keys, editor cursor sync, overwrite dialog, Ctrl-O sub-shell |
| 15a panel essentials | ✅ marking (Ctrl-T), invert (*), sort cycle (Alt-T), history (Alt-H/Y/U), save setup (Alt-Shift-S), listing modes (Alt-L), mini-status, tab completion, cmdline auto-activate, editor block ops + selection highlight |
| 15b shell + exec fixes | ✅ foreground command execution (no popup), Ctrl+O drop/recreate Tui (clean terminal restore) |
| 15c editor + percent + user menu | ✅ bracket match (Alt-B), word completion (Alt-Tab), percent escapes (17 tokens), F2 user menu (INI parser + condition + extension filters) |
| 15d bug fixes + standalone binaries | ✅ ESC no-op on main screen (MC parity), editor arrow keys structural fix (Option B — cursor sync in every move_*/select_*), command execution (no pause, returns immediately), tlcedit + tlcview standalone binaries built and staged alongside tlc |
| 15e syntax highlighter + render wiring | ✅ Highlighter struct, syntax_for_path(), is_text_file() in editor/syntax.rs; wired into Editor::render() with viewport scroll state replay and selection overlay (split_spans_for_selection) |
| 15f Jobs/Panelize/VFS dialogs | ✅ Background jobs dialog (C-x j), external panelize (C-x !), VFS list (C-x a) — all safe Rust, Arc<Mutex<JobRegistry>>, zero unsafe |
| 15g Ctrl-X chord + Compare Dirs + SymlinkRelative + dialogs | ✅ Ctrl-X prefix dispatch (9 follow-ups), Compare Dirs (C-x d size-only), SymlinkRelative (C-x s), SymlinkEdit (C-x v), ScreenList/EditHistory/FilteredView wired, editor format paragraph (Alt-P), viewer growing buffer (tail -f) |
| 15h File highlighting | ✅ Type-based coloring in panel entries (9 categories: executable, archive, audio, video, image, source, documentation, database), extension tables + permission-bit detection |
| 15i VFS archive panel integration | ✅ Browse .tar/.tar.gz/.tar.bz2/.tar.xz/.zip/.cpio archives in-place; Enter opens archive, '..' at root exits to local filesystem; VFS scheme dispatch via for_path() |
| 15j PanelInfo (C-x i) + PanelQuickView (C-x q) | ✅ Inactive panel toggles to Info mode (filesystem summary + cursor file metadata) or QuickView mode (first 30 lines of cursor file, binary detection); toggle-only (excluded from Alt-L listing cycle) |
| 15k Clippy cleanup | ✅ All 20 clippy lints fixed across 9 files; only 1 pre-existing warning remains (mc_ext.rs Include(String) never read) |
| 15l Split ratio + QuitQuiet + menubar + Compare files | ✅ SplitMore/Less (Alt-Shift-Right/Left, 5% steps, 10-90%), QuitQuiet (Shift-F10 actually quits), F9 menubar expanded with all 20+ commands, Compare files (Ctrl-d, LCS diff viewer) |
| 31 SortDialog + truncation + editor toggles | ✅ SortDialog wired to Alt-Shift-T (field/reverse/case), filename truncation indicator (~), editor auto-indent toggle (Alt-A), editor show whitespace toggle (Alt-E) |
| 33 Editor F9 menubar + PLAN refresh | ✅ All editor F9 commands wired (New/Open/Save/SaveAs/Quit/Find/Replace/Bookmarks), Options menu with 5 toggles, Ctrl-X h chord, §14.1-§14.6 tables refreshed (~93% MC parity) |
See PLAN.md for the comprehensive quality assessment and remaining tasks.