Skip to content

CAMEL-23841: camel-jbang - fix TUI layout overflow and add minimum size guard#24284

Open
ammachado wants to merge 3 commits into
apache:mainfrom
ammachado:CAMEL-23841
Open

CAMEL-23841: camel-jbang - fix TUI layout overflow and add minimum size guard#24284
ammachado wants to merge 3 commits into
apache:mainfrom
ammachado:CAMEL-23841

Conversation

@ammachado

@ammachado ammachado commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Description

Fix TUI layout overflow issues visible at 120×43 (the primary target terminal size) and add a minimum-size guard for smaller terminals.

Tab bar overflow: the full tab bar needs ~126 chars and clips 0 More▾ to a bare 0 at 120 columns. Two display modes are now used: full labels ( 1 Overview | 2 Log | ...) at ≥126 cols, compact labels (1 Overview|2 Log|..., ~88 chars) at 88–125 cols. Badge X-position calculation was updated to match the active divider width.

Footer overflow: some tabs have footers that exceed terminal width by 50–80 chars (Diagram: ~170–186, Errors: ~169–199), clipping mid-word. On overflow the footer now drops content in priority order: decorative right-side spans (MCP status, recording) first, then secondary F-key hints (F2/F3/F6), and only then tab-specific action hints (stop/kill/restart). F1 help and the first tab hint are always preserved.

The secondary F-key drop logic is extracted into a package-private static dropFKeyHints helper so it can be unit tested. It removes hint pairs from the tail (F6 first, then F3, F2) and stops before the first pair, so F1 (help) always survives even on a narrow terminal.

Minimum size guard: when the terminal is below 88×24, all rendering is skipped and a btop-style centered message is shown with the current and required dimensions (out-of-range values in orange). Normal rendering resumes automatically on resize — no new event-handling code is needed since TamboUI already re-invokes render(Frame) with current dimensions on every resize.

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

JIRA: https://issues.apache.org/jira/browse/CAMEL-23841

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

AI-assisted contributions

  • If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., Co-authored-by trailers) and the PR description identifies the AI tool used.

Claude Code on behalf of Adriano Machado

@ammachado ammachado requested a review from gnodet June 28, 2026 19:08
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions github-actions Bot added the dsl label Jun 28, 2026
@ammachado ammachado marked this pull request as ready for review June 28, 2026 19:15
@ammachado ammachado requested a review from davsclaus June 28, 2026 19:19
…ze guard

- Tab bar: switch to compact labels (no outer spaces, | divider) when
  terminal width < 126 chars; full labels need 126, compact needs 88
- Footer: on overflow, drop secondary F-key hints (F2/F3/F6) before
  tab-specific action hints (stop/kill/restart) to preserve the most
  actionable hints; right-side decorations (MCP, recording) dropped first
- Minimum size: render a btop-style centered message when terminal is
  below 88x24 instead of clipping content; resumes normal rendering as
  soon as the terminal is resized above the threshold

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ze guard

- Tab bar: switch to compact labels (no outer spaces, | divider) when
  terminal width < 126 chars; full labels need 126, compact needs 88
- Footer: on overflow, drop secondary F-key hints (F2/F3/F6) before
  tab-specific action hints (stop/kill/restart) to preserve the most
  actionable hints; right-side decorations (MCP, recording) dropped first
- Minimum size: render a btop-style centered message when terminal is
  below 88x24 instead of clipping content; resumes normal rendering as
  soon as the terminal is resized above the threshold

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-plugin-tui
All tested modules (2 modules)
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: Launcher :: Container

⚙️ View full build and test results

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on the compact tab bar and the priority-based footer truncation — the approach is solid and the minimum-size guard is a good addition.

One bug in the footer overflow drop loop: the index formula removes F1 (which should be preserved) while keeping F6, when hasHelp=true (the common case). Details in the inline comment.

This review does not replace specialized AI review tools or static analysis.

This review was generated by an AI agent (Claude Code on behalf of Claus Ibsen) and may contain inaccuracies. Please verify all suggestions before applying.

… help

The footer overflow handler dropped F-key hints from the wrong end: with
help text present it removed F1 (which should always be preserved) while
keeping F6. insertFKeyHints returned the secondary-only count and the drop
loop's index formula resolved to the F3 pair, removing F1/F2/F3 in turn.

insertFKeyHints now returns the total F-key span count, and the drop logic
is extracted into a testable static dropFKeyHints helper that removes pairs
from the tail (F6, then F3, F2), stopping before the first pair so F1 (help)
always survives. Added unit tests covering the help, no-help, no-overflow,
and heavy-overflow cases.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ammachado ammachado requested a review from davsclaus June 28, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants