From db04c38974cbc0d9be41f45e2b3745bd69e7c6b4 Mon Sep 17 00:00:00 2001 From: Lstarsky0 <59827030+Lstarsky0@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:48:57 +0800 Subject: [PATCH] fix(tui): drop the /statusline picker's padding rows when the list doesn't fit The /statusline card keeps a blank padding row above and below its content at every size, so when the frame is too short for all eleven items those two rows are spent on chrome while items scroll out of view. At 40x12 the card is 10 rows: border 2, padding 2, header 2 and footer 2 leave room for just Mode and Model. At 60x16 six items show, and at 80x19 Git branch is cut off although the list would fit without the padding. Keep the vertical padding only when the padded card fits the frame; otherwise size the card without it. Horizontal padding is unchanged, so the footer wraps at the same width. 40x12 now shows four items, 60x16 eight, and 80x19 all eleven. Row hitboxes are recorded from the content area, so mouse clicks still land on the painted row. Sizes where the list fits, such as 80x24 and 100x32, render as before. Signed-off-by: Lstarsky0 <59827030+Lstarsky0@users.noreply.github.com> --- crates/tui/src/tui/views/status_picker.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/tui/src/tui/views/status_picker.rs b/crates/tui/src/tui/views/status_picker.rs index fc544bbc50..0e8e49697c 100644 --- a/crates/tui/src/tui/views/status_picker.rs +++ b/crates/tui/src/tui/views/status_picker.rs @@ -215,17 +215,20 @@ impl ModalView for StatusPickerView { ActionHint::new("Esc", tr(self.locale, MessageId::StatusPickerActionCancel)), ]; // Two header lines + one row per StatusItem + the action footer rows - // as they wrap at the popup's inner width, plus the border and - // padding rows above and below. centered_modal_area clamps this to - // the frame and lets the scroll offset absorb any remaining overflow. + // as they wrap at the popup's inner width, plus the border rows, and + // the padding rows above and below when the whole list fits. + // centered_modal_area clamps this to the frame and lets the scroll + // offset absorb any remaining overflow. let popup_width = centered_modal_area(area, 64, 8, 40, 8).width; let footer_rows = action_footer_lines(&hints, popup_width.saturating_sub(4)) .len() .max(1) as u16; - let needed_height = (self.rows.len() as u16) - .saturating_add(6) + let unpadded_height = (self.rows.len() as u16) + .saturating_add(4) .saturating_add(footer_rows); - let popup_area = centered_modal_area(area, 64, needed_height, 40, 8); + let pad = u16::from(unpadded_height.saturating_add(2) <= area.height.saturating_sub(2)); + let popup_area = + centered_modal_area(area, 64, unpadded_height.saturating_add(2 * pad), 40, 8); render_modal_surface(area, popup_area, buf); @@ -239,7 +242,7 @@ impl ModalView for StatusPickerView { .borders(Borders::ALL) .border_style(Style::default().fg(palette::BORDER_COLOR)) .style(Style::default().bg(palette::WHALE_BG)) - .padding(Padding::uniform(1)); + .padding(Padding::new(1, 1, pad, pad)); let inner = block.inner(popup_area); block.render(popup_area, buf);