Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions crates/tui/src/tui/goldens/edit_theme_80x24.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
Current: underwater

Choose:
1. system
2. terminal
3. shoreline
4. shoreline-light
▸ 5. underwater
6. underwater-retro
7. dark
8. light
9. grayscale
10. catppuccin-mocha
11. tokyo-night
1. system █
2. terminal █
3. shoreline █
4. shoreline-light █
▸ 5. underwater █
6. underwater-retro █
7. dark █
8. light █
9. grayscale │
10. catppuccin-mocha │
11. tokyo-night │
[ Apply ] [ Cancel ]
↑/↓ or click choose · Enter/Apply · Esc/Cancel · 1-9 jump
──────────────────────────────────────────────────────────────────────────────
21 changes: 20 additions & 1 deletion crates/tui/src/tui/views/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4367,6 +4367,7 @@ impl ModalView for ConfigView {

let inner =
render_underwater_surface(area, buf, self.tr(MessageId::ConfigModalTitle).to_string());
let mut choice_rail = None;
let (lines, footer) = if let Some(edit) = self.editing.as_ref() {
*self.last_choice_hitboxes.borrow_mut() = Vec::new();
*self.last_editor_controls.borrow_mut() = Vec::new();
Expand Down Expand Up @@ -4463,6 +4464,21 @@ impl ModalView for ConfigView {
.min(max_start);
let end = (start + visible_options).min(choices.len());
let mut hitboxes = Vec::new();
let scrolls = visible_options < choices.len();
if scrolls {
choice_rail = Some((
Rect {
x: inner.x,
y: inner.y.saturating_add(lines.len() as u16),
width: inner.width,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude the scroll rail from choice hitboxes

When choices overflow (for example, Theme at 80×24), this new rail occupies inner.right() - 1, but each entry in last_choice_hitboxes still uses the full inner.width. handle_mouse therefore treats the rail cell as the underlying choice: moving the pointer across rail rows changes the selection and live-previews those themes, while clicking the paint-only cue selects an option. Reserve the rail column from the recorded choice hitboxes, as the settings list already does.

AGENTS.md reference: crates/tui/AGENTS.md:L22-L24

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude Opus 5.5, working for the maintainer.

Confirmed and fixed on main in 3352da9. When the rail is drawn, the choice hitboxes now give up its column, so hovering or clicking the rail no longer selects or live-previews a choice. The hover, live-preview and click paths all hit-test through rect.contains. I merged before reading this review; that was my miss, not @Lstarsky0's.

height: u16::try_from(visible_options).unwrap_or(u16::MAX),
},
choices.len(),
start,
visible_options,
));
}
let label_width = usize::from(inner.width).saturating_sub(8 + usize::from(scrolls));

for (choice_idx, choice) in choices.iter().enumerate().take(end).skip(start) {
let selected = choice_idx == edit.selected_choice;
Expand All @@ -4481,7 +4497,7 @@ impl ModalView for ConfigView {
let mut line = Line::from(format!(
" {marker} {:>2}. {}",
choice_idx + 1,
truncate_view_text(&label, usize::from(inner.width).saturating_sub(8))
truncate_view_text(&label, label_width)
));
line.style = if selected {
menu_style::selected_row_style()
Expand Down Expand Up @@ -4547,6 +4563,9 @@ impl ModalView for ConfigView {
.style(Style::default().fg(palette::TEXT_PRIMARY))
.scroll((0, 0))
.render(body, buf);
if let Some((rail, total, offset, visible)) = choice_rail {
render_panel_scroll_rail(rail, buf, total, offset, visible, true);
}
if content.height > 0 {
self.render_editor_controls(
Rect {
Expand Down
Loading