CMoH commented on code in PR #1716:
URL: https://github.com/apache/karaf/pull/1716#discussion_r1140019185
##########
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:
I think in this particular case I think it will work, since `\n` is included
in the Windows line separator, `\n\r`. Also, the contents of `splitLines()` is
the verbatim top-section of the `getContents()` method, so at least I don't
expect the behaviour to change after this commit.
However, the comment is valid in principle. As you mentioned in
https://github.com/apache/karaf/pull/1715#discussion_r1139063272, this seems to
be a style issue across the entire code base. If so, would it be worth
adressing them all as a separate issue?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]