Skip to content

feat(tui): responsive layout optimizations for small panes #5

Open

Description

@KooshaPari

Problem

In multi-pane layouts (4x2 to 6x6+), individual panes can be as small as 30x7 columns. The current UI has several issues at these sizes:

  • Input box can grow to 10 lines, leaving 0 rows for messages
  • Info widget overlays overlap the transcript when the messages area is tiny
  • Status line text overflows silently in narrow panes (< 35 cols)
  • The idle donut reserves 14 rows even in 7-row panes

Changes

1. Input height cap at pane_height / 3

crates/jcode-tui/src/tui/ui.rs

Clamps base_input_height to min(wrapped_lines, 10, pane_height / 3). In a 7-row pane this limits input to 2 rows (was 5), giving the transcript 3 extra rows.

2. Suppress info widget overlays when messages area < 5 rows

crates/jcode-tui/src/tui/ui.rs

Adds messages_area.height >= 5 to the overlay rendering condition. When the messages area is too small, overlays are skipped entirely.

3. Truncate status line in narrow panes

crates/jcode-tui/src/tui/ui_input.rs

New truncate_line_for_narrow() helper truncates status line spans to fit within max_cols with ellipsis when area.width < 35. Tracks cumulative width across multiple spans to prevent overflow.

4. Suppress idle donut in small panes

crates/jcode-tui/src/tui/ui_animations.rs

Adds available_height parameter to idle_donut_reserved_height(). When pane height < 8 rows (MIN_PANE_FOR_DONUT), donut is suppressed unconditionally so every row is available for content.

Testing

  • truncate_line_for_narrow: 4 unit tests (short text, long text with ellipsis, multi-span cumulative width, empty line)
  • idle_donut_reserved_height: 1 new test for small-pane suppression + updated existing test for new signature

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions