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 dbe0c2c9fc9e camel-jbang-tui: Align columns in Go to Node popup
dbe0c2c9fc9e is described below

commit dbe0c2c9fc9ef3898a595d40d79362f53c1b217d
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Aug 6 23:15:04 2026 +0200

    camel-jbang-tui: Align columns in Go to Node popup
    
    Pad the type tag column so entries align neatly. Remove the
    nodeId suffix column as it adds no value (type + label already
    identify each node).
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../camel/dsl/jbang/core/commands/tui/GotoNodePopup.java | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/GotoNodePopup.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/GotoNodePopup.java
index 076b283b881b..368a2c7cedc1 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/GotoNodePopup.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/GotoNodePopup.java
@@ -165,20 +165,27 @@ class GotoNodePopup {
         String sep = "─".repeat(Math.max(1, popupW - 2));
         items.add(ListItem.from(Line.from(Span.styled(sep, 
Style.EMPTY.dim()))));
 
+        // compute column width for type tag alignment
+        int maxTypeW = 0;
+        for (NodeEntry entry : filteredEntries) {
+            maxTypeW = Math.max(maxTypeW, entry.type().length());
+        }
+        int maxLabelW = popupW - maxTypeW - 6;
+
         Style normalStyle = Style.EMPTY;
         Style matchStyle = Theme.label().bold();
-        Style dimStyle = Style.EMPTY.dim();
         for (NodeEntry entry : filteredEntries) {
             List<Span> spans = new ArrayList<>();
             spans.add(Span.raw(" "));
 
+            String typeTag = entry.type();
+            String typePad = " ".repeat(Math.max(0, maxTypeW - 
typeTag.length()));
             dev.tamboui.style.Color eipColor
-                    = 
org.apache.camel.dsl.jbang.core.commands.tui.diagram.DiagramColors.getEipColor(entry.type());
-            spans.add(Span.styled("[" + entry.type() + "]", 
Style.EMPTY.fg(eipColor).bold()));
+                    = 
org.apache.camel.dsl.jbang.core.commands.tui.diagram.DiagramColors.getEipColor(typeTag);
+            spans.add(Span.styled("[" + typeTag + "]" + typePad, 
Style.EMPTY.fg(eipColor).bold()));
             spans.add(Span.raw(" "));
 
             String searchable = entry.label().isBlank() ? entry.nodeId() : 
entry.label();
-            int maxLabelW = popupW - entry.type().length() - 
entry.nodeId().length() - 10;
             if (searchable.length() > maxLabelW && maxLabelW > 3) {
                 searchable = searchable.substring(0, maxLabelW - 1) + "…";
             }
@@ -195,7 +202,6 @@ class GotoNodePopup {
                 spans.add(Span.styled(searchable, normalStyle));
             }
 
-            spans.add(Span.styled(" (" + entry.nodeId() + ")", dimStyle));
             items.add(ListItem.from(Line.from(spans)));
         }
 

Reply via email to