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
7 changes: 5 additions & 2 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,11 @@ pub fn draw(
Mode::Tree => {
// Full-screen modal — the tree renderer takes the WHOLE frame
// area, not just the sidebar column, so the player gets the
// full canvas to pan around.
let out = tree::draw(frame, area, state, mouse_pos, tree_render);
// full canvas to pan around. Pass the live `help_height` so
// the modal covers exactly down to the help bar; hardcoding
// a `2` here used to leak a one-row strip of biscuit when
// the help text wrapped to a single row.
let out = tree::draw(frame, area, state, mouse_pos, tree_render, help_height);
tree_node_rects = out.node_rects;
tree_action_button = out.action_button;
}
Expand Down
14 changes: 9 additions & 5 deletions src/ui/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ const PAN_SNAP_EPSILON: f32 = 0.5;
/// of edges.
const VISIBLE_RADIUS_LOTS: i32 = 6;

/// Help bar height reserved at the bottom — `ui::mod.rs` rendered the help
/// text there before we got the frame, so we leave those rows alone.
const HELP_BAR_HEIGHT: u16 = 2;

const INFO_PANE_HEIGHT: u16 = 8;
const HEADER_HEIGHT: u16 = 3;

Expand All @@ -68,8 +64,16 @@ pub fn draw(
state: &GameState,
mouse_pos: Option<(u16, u16)>,
tree_render: &mut TreeRenderState,
help_bar_height: u16,
) -> TreeDrawOutput {
let modal_h = area.height.saturating_sub(HELP_BAR_HEIGHT);
// `help_bar_height` is the actual `wrapped_height(help_text, ...)`
// ui::mod.rs reserved for the bottom help row(s). When the help
// text fits in a single row it's 1, otherwise 2; passing the live
// value lets the modal hug exactly the row above the help bar,
// so the biscuit + hands rendered into `left[1]` underneath stay
// fully covered. A previous hardcoded `2` left a one-row strip
// exposed whenever `help_bar_height == 1`.
let modal_h = area.height.saturating_sub(help_bar_height);
if modal_h < HEADER_HEIGHT + INFO_PANE_HEIGHT + 4 {
// Terminal too small; bail out gracefully.
return TreeDrawOutput {
Expand Down
Loading