From be5030b19780873d272e5dd07db74473f06c9499 Mon Sep 17 00:00:00 2001 From: ch4xer Date: Tue, 4 Aug 2026 14:07:05 +0800 Subject: [PATCH 1/2] fix(tui): remove extra spacing between message area and composer Use exact Length constraints with actual viewport line counts instead of Constraint::Min(1) which forced an extra blank row in the history area. Remove the +2 padding in desired_height and the saturating_sub(1) clamping in chat_layout_areas so the viewport height is always exactly the sum of content heights with no leftover blank rows. Co-Authored-By: Claude --- crates/tui/src/chatwidget/render.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/tui/src/chatwidget/render.rs b/crates/tui/src/chatwidget/render.rs index 27c7dbb4..b678b1e6 100644 --- a/crates/tui/src/chatwidget/render.rs +++ b/crates/tui/src/chatwidget/render.rs @@ -119,7 +119,6 @@ impl Renderable for ChatWidget { history_height .saturating_add(self.subagent_live_list_desired_height()) .saturating_add(self.bottom_pane.desired_height(width)) - .saturating_add(2) } fn cursor_pos(&self, area: Rect) -> Option<(u16, u16)> { @@ -139,12 +138,17 @@ impl ChatWidget { let bottom_height = self .bottom_pane .desired_height(area.width) - .min(area.height.saturating_sub(1).max(3)); + .min(area.height); let subagent_height = self .subagent_live_list_desired_height() - .min(area.height.saturating_sub(bottom_height).saturating_sub(1)); + .min(area.height.saturating_sub(bottom_height)); + let history_height = u16::try_from( + self.active_viewport_lines(area.width.max(1)).len(), + ) + .unwrap_or(u16::MAX) + .min(area.height.saturating_sub(bottom_height).saturating_sub(subagent_height)); let [history_area, subagent_area, bottom_area] = Layout::vertical([ - Constraint::Min(1), + Constraint::Length(history_height), Constraint::Length(subagent_height), Constraint::Length(bottom_height), ]) From 4dbf0a5671e1226eb80136db788171c585108492 Mon Sep 17 00:00:00 2001 From: ch4xer Date: Tue, 4 Aug 2026 14:14:53 +0800 Subject: [PATCH 2/2] style(tui): apply cargo fmt Co-Authored-By: Claude --- crates/tui/src/chatwidget/render.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/tui/src/chatwidget/render.rs b/crates/tui/src/chatwidget/render.rs index b678b1e6..610c92a7 100644 --- a/crates/tui/src/chatwidget/render.rs +++ b/crates/tui/src/chatwidget/render.rs @@ -135,18 +135,17 @@ impl Renderable for ChatWidget { impl ChatWidget { fn chat_layout_areas(&self, area: Rect) -> (Rect, Rect, Rect) { - let bottom_height = self - .bottom_pane - .desired_height(area.width) - .min(area.height); + let bottom_height = self.bottom_pane.desired_height(area.width).min(area.height); let subagent_height = self .subagent_live_list_desired_height() .min(area.height.saturating_sub(bottom_height)); - let history_height = u16::try_from( - self.active_viewport_lines(area.width.max(1)).len(), - ) - .unwrap_or(u16::MAX) - .min(area.height.saturating_sub(bottom_height).saturating_sub(subagent_height)); + let history_height = u16::try_from(self.active_viewport_lines(area.width.max(1)).len()) + .unwrap_or(u16::MAX) + .min( + area.height + .saturating_sub(bottom_height) + .saturating_sub(subagent_height), + ); let [history_area, subagent_area, bottom_area] = Layout::vertical([ Constraint::Length(history_height), Constraint::Length(subagent_height),