This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 60ce64497d4f chore: camel-jbang - the run form has no empty rows below
its last option (#27235)
60ce64497d4f is described below
commit 60ce64497d4f95a108d8345ee2d4d4c3312e50f1
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Oct 1 23:02:26 2026 +0200
chore: camel-jbang - the run form has no empty rows below its last option
(#27235)
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---
.../jbang/core/commands/tui/RunOptionsForm.java | 4 +--
.../core/commands/tui/RunOptionsFormTest.java | 40 ++++++++++++++++++++++
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsForm.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsForm.java
index 821316ee3f1d..a4f2296136ba 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsForm.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsForm.java
@@ -42,8 +42,6 @@ class RunOptionsForm {
private static final int PAGE_OPTIONS = 0;
private static final int PAGE_PROPERTIES = 1;
- /** Fixed height of the options page; the properties page is aligned to
it. */
- private static final int PAGE1_HEIGHT = 18;
// Row indices for page 0
private static final int ROW_NAME = 0;
@@ -61,6 +59,8 @@ class RunOptionsForm {
private static final int ROW_OTEL_AGENT = 12;
private static final int ROW_JFR = 13;
private static final int ROW_COUNT = 14;
+ /** Height of the options page: a row per option plus the border; the
properties page is aligned to it. */
+ private static final int PAGE1_HEIGHT = ROW_COUNT + 2;
private boolean visible;
private int page;
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsFormTest.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsFormTest.java
index 8d00b76d5cf8..70f87f09c609 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsFormTest.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsFormTest.java
@@ -16,8 +16,12 @@
*/
package org.apache.camel.dsl.jbang.core.commands.tui;
+import java.util.ArrayList;
import java.util.List;
+import dev.tamboui.buffer.Buffer;
+import dev.tamboui.layout.Rect;
+import dev.tamboui.terminal.Frame;
import dev.tamboui.tui.event.KeyCode;
import dev.tamboui.tui.event.KeyEvent;
import dev.tamboui.tui.event.KeyModifiers;
@@ -102,4 +106,40 @@ class RunOptionsFormTest {
assertThat(args).contains("--open-telemetry-agent");
assertThat(args).doesNotContain("--jfr");
}
+
+ @Test
+ void optionsPageHasNoBlankRows() {
+ RunOptionsForm form = openForm();
+ // no app holds a port, so the form shows no port warning that would
take a row of its own
+ form.setIntegrations(List::of);
+
+ List<String> inner = renderPopupRows(form);
+
+ // Name .. JFR: one row each, nothing left empty below the last
checkbox
+ assertThat(inner).hasSize(14 +
(form.portWarning(System.currentTimeMillis()) != null ? 1 : 0));
+ assertThat(inner).noneMatch(String::isBlank);
+ }
+
+ /** The rows inside the popup border (between the top and bottom edge),
with the side borders cut off. */
+ private static List<String> renderPopupRows(RunOptionsForm form) {
+ Rect area = new Rect(0, 0, 100, 40);
+ Buffer buffer = Buffer.empty(area);
+ Theme.resetForTesting();
+ form.render(Frame.forTesting(buffer), area);
+ String[] lines =
HealthTabRenderTest.bufferToString(buffer).split("\n");
+ List<String> inner = new ArrayList<>();
+ boolean in = false;
+ for (String line : lines) {
+ if (line.contains("╭")) {
+ in = true;
+ } else if (line.contains("╰")) {
+ break;
+ } else if (in) {
+ int left = line.indexOf('│');
+ int right = line.lastIndexOf('│');
+ inner.add(line.substring(left + 1, right));
+ }
+ }
+ return inner;
+ }
}