wborn commented on code in PR #1716:
URL: https://github.com/apache/karaf/pull/1716#discussion_r1139062134


##########
shell/core/src/main/java/org/apache/karaf/shell/support/table/Col.java:
##########
@@ -148,8 +149,14 @@ String format(Object cellData) {
         if (fullContent.length() == 0) {
             return "";
         }
-        String finalContent = cut(fullContent, 
getClippedSize(fullContent.length()));
-        updateSize(finalContent.length());
+        if (wrap && size < fullContent.length()) {
+            // make sure splitLines will have an estimate cell size if wrap is 
true
+            updateSize(fullContent.length());
+        }
+        List<String> lines = splitLines(fullContent);
+        int maxLineSize = 
lines.stream().mapToInt(String::length).max().getAsInt(); // at least one line 
exists due to test above
+        updateSize(maxLineSize); // calls getClippedSize()
+        String finalContent = lines.stream().map(line -> cut(line, 
getClippedSize(line.length()))).collect(Collectors.joining("\n"));

Review Comment:
   Will this work on Windows which uses a different line separator?
   E.g. using `System.lineSeparator()` instead of `\n` would be based on the OS.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@karaf.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to