fix(tui): right-align the /theme row numbers

Theme rows print "{n}. " and then a fixed-width name, so once the list
reaches 10 every row from there on starts its name, swatch and tagline
one column right of the rows above it:

     9. Grayscale                         Color-minimal high contrast
     10. Catppuccin Mocha                  Soft pastels on warm dark

Pad the number to the width of the largest one, the way the /settings
choice lists already number their rows (" 9. ko" / "10. ca"). The
80x24 and 120x32 theme picker goldens change on rows 1-9 only; at 80x24
the Blue Stage tagline sheds one more word to stay in its slot.

Signed-off-by: Lstarsky0 <[email protected]>
This commit is contained in:
Lstarsky0 committed 2026-10-16 19:34:31 +08:00
1 parent 9f25ef094c
commit fc0003d059
3 files changed
+23 -19

No files matched your search

@@ -2,15 +2,15 @@
theme · live preview ────────────────────────────────────────────────────────────────────────────────────────────────
1. System Follow terminal background (COLORFGBG / macOS appearance)
2. Terminal Inherit terminal colors fully (transparent surfaces, ANSI accents)
3. Shoreline Warm charcoal, one restrained blue — the desktop client's palette
4. Shoreline Light Shoreline on warm paper — the desktop client's light mode
▸ 5. Underwater The painted ocean field: ombre water, ambient life, the whale
6. Underwater Retro Flat phosphor-teal ocean: the legacy deepsea look, no ombre
7. Blue Stage Stage black, action blue, and one Signal Gold human beacon
8. Blue Stage Light Paper, cobalt action, and one Signal Gold human beacon
9. Grayscale Color-minimal high contrast
1. System Follow terminal background (COLORFGBG / macOS appearance)
2. Terminal Inherit terminal colors fully (transparent surfaces, ANSI accents)
3. Shoreline Warm charcoal, one restrained blue — the desktop client's palette
4. Shoreline Light Shoreline on warm paper — the desktop client's light mode
▸ 5. Underwater The painted ocean field: ombre water, ambient life, the whale
6. Underwater Retro Flat phosphor-teal ocean: the legacy deepsea look, no ombre
7. Blue Stage Stage black, action blue, and one Signal Gold human beacon
8. Blue Stage Light Paper, cobalt action, and one Signal Gold human beacon
9. Grayscale Color-minimal high contrast
10. Catppuccin Mocha Soft pastels on warm dark
11. Tokyo Night Deep blue/violet night palette
12. Dracula Classic high-contrast purple
@@ -2,15 +2,15 @@
theme · live preview ────────────────────────────────────────────────────────
█
1. System Follow terminal background… █
2. Terminal Inherit terminal colors fully… █
3. Shoreline Warm charcoal, one restrained… █
4. Shoreline Light Shoreline on warm paper — the… █
▸ 5. Underwater The painted ocean field: ombre… █
6. Underwater Retro Flat phosphor-teal ocean: the… █
7. Blue Stage Stage black, action blue, and one… █
8. Blue Stage Light Paper, cobalt action, and one… █
9. Grayscale Color-minimal high contrast █
1. System Follow terminal background… █
2. Terminal Inherit terminal colors fully… █
3. Shoreline Warm charcoal, one restrained… █
4. Shoreline Light Shoreline on warm paper — the… █
▸ 5. Underwater The painted ocean field: ombre… █
6. Underwater Retro Flat phosphor-teal ocean: the… █
7. Blue Stage Stage black, action blue, and… █
8. Blue Stage Light Paper, cobalt action, and one… █
9. Grayscale Color-minimal high contrast █
10. Catppuccin Mocha Soft pastels on warm dark █
11. Tokyo Night Deep blue/violet night palette █
12. Dracula Classic high-contrast purple █
+5 -1
View File
@@ -368,6 +368,7 @@ impl ModalView for ThemePickerView {
.saturating_sub(header_rows)
.max(1);
let source_count = self.controller.visible().len();
let number_width = source_count.to_string().len();
let selected_visible = self.controller.selected_visible();
let max_start = source_count.saturating_sub(visible_rows);
let start = selected_visible
@@ -447,7 +448,10 @@ impl ModalView for ThemePickerView {
let mut spans: Vec<Span> = Vec::with_capacity(8);
spans.push(Span::styled(format!(" {pointer} "), row_style));
spans.push(Span::styled(format!("{}. ", visible_idx + 1), number_style));
spans.push(Span::styled(
format!("{:>number_width$}. ", visible_idx + 1),
number_style,
));
spans.push(Span::styled(format!("{:<22}", option.label), row_style));
spans.extend(swatch);
spans.push(Span::raw(" "));