This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-23648-run-folder in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3c94d5bbc362308c647c9c3cf61798175e7a1df4 Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jun 1 10:58:39 2026 +0200 CAMEL-23648: camel-jbang - TUI clip and right-align property source in Configuration tab Co-Authored-By: Claude Opus 4.6 <[email protected]> --- .../jbang/core/commands/tui/ConfigurationTab.java | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ConfigurationTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ConfigurationTab.java index 867ed7921492..5bab0d7e6d57 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ConfigurationTab.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ConfigurationTab.java @@ -35,6 +35,7 @@ import dev.tamboui.widgets.block.BorderType; import dev.tamboui.widgets.paragraph.Paragraph; import dev.tamboui.widgets.scrollbar.Scrollbar; import dev.tamboui.widgets.scrollbar.ScrollbarState; +import org.apache.camel.util.FileUtil; import static org.apache.camel.dsl.jbang.core.commands.tui.MonitorContext.*; @@ -152,6 +153,11 @@ class ConfigurationTab implements MonitorTab { } int keyWidth = Math.min(maxKeyLen, inner.width() / 2); + List<Rect> hChunks = Layout.horizontal() + .constraints(Constraint.fill(), Constraint.length(1)) + .split(inner); + int lineWidth = hChunks.get(0).width(); + // Build visible lines, inserting divider at the right display position List<Line> lines = new ArrayList<>(); int displayRow = 0; @@ -167,15 +173,11 @@ class ConfigurationTab implements MonitorTab { } } if (displayRow >= scrollOffset) { - lines.add(renderProperty(props.get(i), keyWidth)); + lines.add(renderProperty(props.get(i), keyWidth, lineWidth)); } displayRow++; } - List<Rect> hChunks = Layout.horizontal() - .constraints(Constraint.fill(), Constraint.length(1)) - .split(inner); - frame.renderWidget(Paragraph.builder().text(Text.from(lines)).build(), hChunks.get(0)); if (totalLines > visibleLines) { @@ -187,7 +189,7 @@ class ConfigurationTab implements MonitorTab { } } - private Line renderProperty(ConfigProperty prop, int keyWidth) { + private Line renderProperty(ConfigProperty prop, int keyWidth, int lineWidth) { String key = prop.key; if (key.length() > keyWidth) { key = key.substring(0, keyWidth - 1) + "…"; @@ -200,10 +202,15 @@ class ConfigurationTab implements MonitorTab { String value = prop.value != null ? prop.value : ""; List<Span> spans = new ArrayList<>(); - spans.add(Span.styled(" " + key + " ", KEY_STYLE)); + String keyPart = " " + key + " "; + spans.add(Span.styled(keyPart, KEY_STYLE)); spans.add(Span.styled(value, valStyle)); if (prop.source != null && !prop.source.isEmpty()) { - spans.add(Span.styled(" [" + prop.source + "]", SOURCE_STYLE)); + String displaySource = FileUtil.stripPath(prop.source); + String sourceText = "[" + displaySource + "]"; + int used = keyPart.length() + value.length(); + int gap = Math.max(2, lineWidth - used - sourceText.length()); + spans.add(Span.styled(" ".repeat(gap) + sourceText, SOURCE_STYLE)); } return Line.from(spans);
