Implement Recent Files feature all phases
Files and images attached to this public thread are only available to signed-in users.
Sign inClean! The issue is only with --all-targets which picks up other agents' changes. Our code is clean.
Here's a summary of the Recent Files feature implementation across all 5 phases:
Phase 1 - Core Data Structures:
- Created
src/recent_files.rswithRecentEntryandRecentFilesstructs (serde JSON, MRU ordering, max 50 entries, add/remove/clear/prune_missing) - Added
recent_files_path()tosrc/config_paths.rs - 9 unit tests passing
Phase 2 - AppModel Integration:
- Added
recent_files: RecentFilesfield toAppModel - Loads from
~/.config/token-editor/recent.jsonon startup - Added
record_file_opened()method with async save (background thread)
Phase 3 - File Open Hooks:
AppMsg::FileLoadedinsrc/update/app.rs— records loaded filesopen_file_in_new_tab()insrc/update/layout.rs— records tab opens- CLI file args in
src/runtime/app.rs— records initial files
Phase 4 - Recent Files Modal:
- Added
ModalId::RecentFilesandRecentFilesStatewith filter input - Added
CommandId::OpenRecentFileswith command palette entry - Added
Command::OpenRecentFilesto keymap system withCmd+Ebinding - Full modal message handling (navigation, filter, selection, confirm → opens file)
Phase 5 - Rendering:
- Modal renders with title, filter input, scrollable file list with file icons, display paths, and right-aligned "time ago" text
- Reuses
file_finder_layoutgeometry for consistent sizing - Hit-testing support for click handling
Both fixes applied:
Current file excluded —
RecentFilesState::new()now takes the current file path and filters it out, so the top entry is always the previous file. Cmd+E → Enter swaps to it, then Cmd+E → Enter swaps back.Icon removed — The Nerd Font glyphs can't render with the editor's built-in font, so the recent files list now shows just the display path without the broken icon character.
The font is JetBrainsMono.ttf (274KB, regular version without Nerd Font glyphs). Let me download the Nerd Font version:
The official Nerd Font version is available. Let me download JetBrainsMonoNerdFont-Regular.ttf from the v3.4.0 release:
We want JetBrainsMonoNerdFontMono-Regular.ttf — the monospaced variant ensures all glyphs (including icons) are single-width, which is critical for a code editor:
Now let me also re-add the file icon to the recent files rendering since the Nerd Font should render it properly now:
Replaced assets/JetBrainsMono.ttf with JetBrains Mono Nerd Font Mono (v3.4.0) — the monospaced variant that includes all Nerd Font glyphs. The font went from 274KB → 2.4MB since it bundles ~10K extra icon glyphs. Re-added the file type icons to the recent files modal since they should now render correctly.