Expand description
Declarative SettingDef table for the /settings TUI panel.
Task 1 of the settings-panel rewrite. Owns the static metadata
(key, tab, group, label, description, widget kind, conditional
visibility) for every editable setting plus the typed accessors
get_display_value / apply_change. The renderer, the per-widget
editors, and the map-editor screens consume this table and never
reach into Settings fields directly.
The two MapEditor settings (keybindings, model_roles) are
structured-editor territory: their rows expand into per-entry lists
(SettingsMapRow) and their commits go through the typed helpers
below (set_action_combos, set_model_role, remove_model_role),
never through the scalar apply_change.
Constraints carried from the task brief:
Settingsitself is unchanged — this module adds ACCESS, not persisted state.apply_changeforDisabledTools/ModelRoles/Keybindingsmustbail!so a stray scalar call is loud, never a silent no-op (their structured editors own those fields).
Structs§
- Setting
Def - Declarative metadata for a single setting row.
Enums§
- Setting
Key - Stable identifier for every editable setting in the panel.
- Setting
Widget - Widget kind used to edit the row. The renderer dispatches on this.
- Settings
MapRow - Row-kind metadata for the map-editor expansions, index-aligned with
the items emitted by
settings_overlay_items(crate::tui_vt::slash::registry). - Settings
Tab - Top-level tab the row renders under.
Constants§
- SETTING_
DEFS - The full table. Order matters:
defs_for_tabpreserves it and the renderer renders groups contiguously, so visually related rows must sit next to each other (and a new group must start with a fresh header row).
Functions§
- apply_
change - Apply a scalar edit.
- defs_
for_ tab - Return every def that belongs to
tab, in declaration order, with each row’sconditionevaluated againsts. - get_
display_ value - Render the row’s current value as a string. The renderer uses this
for both the right-hand summary cell and (for
Cyclewidgets) the “next value” preview. - remove_
model_ role - Remove one
model_rolesentry. Returns whether the role existed. Unlike keybindings there is no last-entry guard — an emptymodel_rolesis a perfectly valid state. - set_
action_ combos - Record
action’s full effective combo list insettings.keybindings. When the list is identical to the built-in default the override entry is removed instead, so the persisted map stays minimal (Keymap::from_settingsre-seeds defaults anyway). - set_
model_ role - Insert or update one
model_rolesentry. - toggle_
disabled_ tool - Toggle-helper used by the
DisabledToolsmultiselect editor (Task 5).enabled = trueremoves the tool from the disabled set;enabled = falseadds it if absent.