From dde298692b24d1cf5d6cffcb01c09ebf03974471 Mon Sep 17 00:00:00 2001 From: Lstarsky0 <59827030+Lstarsky0@users.noreply.github.com> Date: Mon, 19 Oct 2026 21:32:25 +0800 Subject: [PATCH] fix(tui): drop the hotbar setup rows' description stub beside the detail pane MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 100 columns up, /keys (Hotbar setup) puts the action list and the selected action's details side by side. The list column is then 40 to 48 wide, and the marker, recommended tag, name and status take 39 of it, so each row's description gets at most nine columns. At 100x32 every row ends in a lone "…"; at 120x32 and 140x40 rows read "Open…", "Shrink…", "Do…". The full description is already in the detail pane. When the layout is split, leave the description out of the rows and let the detail pane show it. The stacked layout below 100 columns, and the 80-column text export, keep their descriptions, so 60x16, 80x24 and 98x30 render as before. A disabled row's reason still follows its status. Signed-off-by: Lstarsky0 <59827030+Lstarsky0@users.noreply.github.com> --- crates/tui/src/tui/hotbar/setup.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/crates/tui/src/tui/hotbar/setup.rs b/crates/tui/src/tui/hotbar/setup.rs index 35b6d70c1a..1e594252a0 100644 --- a/crates/tui/src/tui/hotbar/setup.rs +++ b/crates/tui/src/tui/hotbar/setup.rs @@ -483,7 +483,7 @@ impl HotbarSetupView { }; for (idx, row) in self.actions_for_source(source).iter().enumerate() { - lines.push(self.action_row_line(source, idx, row, 80)); + lines.push(self.action_row_line(source, idx, row, 80, true)); } lines.push(Line::from("")); @@ -606,6 +606,7 @@ impl HotbarSetupView { idx: usize, row: &HotbarSetupActionRow, max_width: u16, + show_description: bool, ) -> Line<'static> { let selected = idx == self.selected_action_idx(source); let marker = crate::tui::glyphs::selection_marker(selected); @@ -634,9 +635,14 @@ impl HotbarSetupView { } else { String::new() }; + let (prefix, description) = if show_description { + (prefix.as_str(), row.metadata.description.as_str()) + } else { + (prefix.trim_end(), "") + }; let text = crate::tui::ui_text::semantic_truncate_with_affixes( - &prefix, - &row.metadata.description, + prefix, + description, &suffix, usize::from(max_width), ); @@ -663,7 +669,7 @@ impl HotbarSetupView { .render(area, buf); } - fn render_action_list(&self, area: Rect, buf: &mut Buffer) { + fn render_action_list(&self, area: Rect, buf: &mut Buffer, show_descriptions: bool) { let Some(source) = self.selected_source() else { EmptyState::new("No actions", "No hotbar action sources are available.") .render(area, buf); @@ -693,7 +699,7 @@ impl HotbarSetupView { let visible_range = action_list_visible_range(self.selected_action_idx(source), rows.len(), visible_rows); for idx in visible_range { - lines.push(self.action_row_line(source, idx, rows[idx], area.width)); + lines.push(self.action_row_line(source, idx, rows[idx], area.width, show_descriptions)); } Paragraph::new(lines) .style(Style::default().fg(palette::TEXT_PRIMARY)) @@ -972,7 +978,7 @@ impl ModalView for HotbarSetupView { height: content.height.saturating_sub(header_height), }; let layout = ListDetailLayout::split(body, 34); - self.render_action_list(layout.list, buf); + self.render_action_list(layout.list, buf, layout.stacked); self.render_action_detail(layout.detail, buf); } @@ -1521,7 +1527,7 @@ mod tests { }; let text = view - .action_row_line(HotbarActionCategory::App, 0, &row, 58) + .action_row_line(HotbarActionCategory::App, 0, &row, 58, true) .to_string(); assert!(crate::tui::ui_text::text_display_width(&text) <= 58); assert!(text.contains("Open a detailed…"), "{text:?}");