This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch feature/CAMEL-25208-code-assist
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8b8d5741e58684aa3e3c00da1223d12b1b95bd4e
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Sep 30 23:13:14 2026 +0200

    CAMEL-25208: camel-jbang - TUI quick doc keeps the first sentence whole
    
    The quick doc of an option was cut at its first dot: "The maximum
    capacity of the SEDA queue (i." for "(i.e., the number of messages it can
    hold)". It is cut at the end of the first sentence now: a period followed
    by a space or the end, not the one of e.g. or i.e., a number or a file
    name. Found testing the Java quick doc in the TUI; YAML has the same doc.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../dsl/jbang/core/commands/tui/EipDocSupport.java      | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EipDocSupport.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EipDocSupport.java
index 0372937f204b..acb7732a2d33 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EipDocSupport.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EipDocSupport.java
@@ -381,11 +381,26 @@ final class EipDocSupport {
         return Math.max(0, fallback);
     }
 
+    /**
+     * The period that ends the first sentence: one followed by a space or the 
end of the text, and not the period of an
+     * abbreviation (e.g., i.e.) - not the dot of (i.e., a number such as 0.5, 
or a name such as file.txt.
+     */
+    static int sentenceEnd(String text) {
+        for (int i = text.indexOf('.'); i >= 0; i = text.indexOf('.', i + 1)) {
+            boolean end = i + 1 == text.length() || 
Character.isWhitespace(text.charAt(i + 1));
+            if (end && !text.regionMatches(true, Math.max(0, i - 3), "e.g", 0, 
3)
+                    && !text.regionMatches(true, Math.max(0, i - 3), "i.e", 0, 
3)) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
     static String truncateText(String text, int maxLen) {
         if (text == null) {
             return "";
         }
-        int dot = text.indexOf('.');
+        int dot = sentenceEnd(text);
         if (dot > 0 && dot < maxLen) {
             return text.substring(0, dot + 1);
         }

Reply via email to