Files
RedBear-OS/local
kellito d4ddc4e2c7 tlc: Sprint 2 B4 — configurable tab width via Alt-T cycle
Adds user-facing control over the editor tab width.

New methods on Editor (editor/mod.rs):
  tab_width() -> usize
    - Returns current visual tab width in spaces.
  set_tab_width(width: usize)
    - Sets tab width, clamped to min 1.
  cycle_tab_width() -> usize
    - Cycles 4 → 8 → 2 → 4 (default 4 → wider → narrower → back).
    - Returns the new width.

Alt-T binding (editor/handlers.rs):
  try_global_shortcut now handles Alt-T (0x74) and calls
  cycle_tab_width(). Status bar shows 'Tab width: N'.

Tab-to-indent (B3) and word-wrap (B1) both consume tab_width
via the field, so changing it via Alt-T takes effect immediately
on next render / insert.

Tests (5 new in editor::tests):
  - tab_width_default_is_four
  - set_tab_width_updates_field (verifies 0 → 1 clamp)
  - cycle_tab_width_advances_2_4_8_2
  - cycle_tab_width_from_unusual_value_resets_to_2
  - tab_to_indent_uses_current_tab_width

Config wiring note: cfg.editor.tab_width (config.rs) already has
the field with serde defaults and persistence. Wiring it into
Editor::open() requires the constructor to accept &Config and
is deferred to a future sprint.

Total: 1253 passing (was 1248; +5 new).
2026-07-05 16:59:18 +03:00
..