Expand description
Command palette state and rendering (keyboard-first, fuzzy-ish search).
Integration hooks live in src/ui/app.rs; this module stays side-effect free.
§Interaction Contract
| Trigger | Behavior |
|---|---|
| Ctrl+P / Alt+P | Open palette → push focus trap GROUP_PALETTE |
| Esc | Close palette → pop focus trap, discard query |
| Enter | Execute selected action → close → dispatch CassMsg |
| Up / k | Move selection -1 (wraps) |
| Down / j | Move selection +1 (wraps) |
| Ctrl+U | Clear query |
| Any printable | Append to query → refilter → reset selection to 0 |
| Backspace | Remove last char → refilter |
§Action Groups
Each PaletteAction belongs to exactly one PaletteGroup. Groups are
used for categorical rendering (section headers, icons) and mapping validation.
| Group | Actions |
|---|---|
| Chrome | ToggleTheme, ToggleDensity, ToggleHelpStrip, OpenUpdate |
| Filter | FilterAgent, FilterWorkspace, FilterToday/Week/CustomDate |
| View | OpenSavedViews, SaveViewSlot, LoadViewSlot, BulkActions, ReloadIndex |
| Analytics | AnalyticsDashboard..AnalyticsCoverage |
| Export | ScreenshotHtml, ScreenshotSvg, ScreenshotText |
| Recording | MacroRecordingToggle |
| Sources | Sources |
§Migration Target (FrankenTUI command_palette)
Each action maps to exactly one CassMsg dispatch (or batch). The mapping
table in PaletteAction::target_msg_name documents the concrete target
for every variant, ensuring no action is lost during migration.
§Filter Modes (F9 cycling)
PaletteMatchMode cycles through All → Exact → Prefix → WordStart →
Substring → Fuzzy → All. Each mode trades recall for precision: All shows
every action (useful for browsing), while Exact/Prefix are fast for users who
know what they want. The Bayesian scorer in app.rs combines match-mode
evidence with recency and frequency priors.
§Test Coverage
59 unit tests in this module cover: match mode cycling, action serialization
round-trips, group membership exhaustiveness, and default_actions() stability.
12 regression tests in app.rs cover: lifecycle, dispatch coverage for all
28 action variants, boundary wrapping, rapid open/close, and selection clamping.
Structs§
- Palette
Item - Render-ready descriptor for an action.
- Palette
State
Enums§
- Analytics
Target - Analytics sub-views addressable from the palette.
- Input
Mode Target - Input mode the palette can request.
- Palette
Action - Action identifiers the palette can emit. These map to app-level commands.
- Palette
Group - Categorical grouping for palette actions. Used for section headers, icons, and migration validation.
- Palette
Match Mode - Match-type filter mode for the command palette.
- Palette
Result - Semantic result of executing a palette action. Decoupled from
CassMsgso that palette.rs stays side-effect free and doesn’t depend on app.rs. - Screenshot
Target - Screenshot export formats addressable from the palette.
- Time
Filter Preset - Time filter presets the palette can apply.
Functions§
- action_
by_ id - Find the
PaletteActionwhoseaction_idmatchesid. - action_
id - Generate a stable string ID for a palette action.
- default_
actions - Prebuilt action catalog with keyboard shortcut hints from
shortcuts. - execute_
selected - Execute the currently selected palette action, returning a
PaletteResult.