[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-07-20 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745411#comment-17745411
 ] 

ASF subversion and git services commented on KARAF-7678:


Commit bd812bd0f9aab0fd3e02b76a55837276a59ddd6a in karaf's branch 
refs/heads/karaf-4.3.x from Ciprian Ciubotariu
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=bd812bd0f9 ]

[KARAF-7678] Fix ShellTable multiline clipping

Account for multi-line cell contents when calculating cell width and
clipping the text to maxSize. The cell contents might be either wrapped
or originally split by the caller with \n characters

(cherry picked from commit 78222c0ae567b5b504327cbce8cbabd0904e6edf)


> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Assignee: Jean-Baptiste Onofré
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-07-20 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745407#comment-17745407
 ] 

ASF GitHub Bot commented on KARAF-7678:
---

jbonofre merged PR #1716:
URL: https://github.com/apache/karaf/pull/1716




> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Assignee: Jean-Baptiste Onofré
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-07-20 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745408#comment-17745408
 ] 

ASF GitHub Bot commented on KARAF-7678:
---

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


##
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 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 would address the split line separator in another PR. Anyway I don't think 
it's a big deal :)





> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Assignee: Jean-Baptiste Onofré
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-07-20 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745410#comment-17745410
 ] 

ASF subversion and git services commented on KARAF-7678:


Commit 4281542e823c1bce1445e444816a5a742f8f288c in karaf's branch 
refs/heads/main from JB Onofré
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=4281542e82 ]

Merge pull request #1716 from CMoH/karaf-7678-fix-shelltable-multiline-clipping

[KARAF-7678] Fix ShellTable multiline clipping

> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Assignee: Jean-Baptiste Onofré
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-07-20 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17745409#comment-17745409
 ] 

ASF subversion and git services commented on KARAF-7678:


Commit 78222c0ae567b5b504327cbce8cbabd0904e6edf in karaf's branch 
refs/heads/main from Ciprian Ciubotariu
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=78222c0ae5 ]

[KARAF-7678] Fix ShellTable multiline clipping

Account for multi-line cell contents when calculating cell width and
clipping the text to maxSize. The cell contents might be either wrapped
or originally split by the caller with \n characters


> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Assignee: Jean-Baptiste Onofré
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-03-17 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17701617#comment-17701617
 ] 

ASF GitHub Bot commented on KARAF-7678:
---

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 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?





> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-03-16 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17701306#comment-17701306
 ] 

ASF GitHub Bot commented on KARAF-7678:
---

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 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.





> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-03-16 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17701304#comment-17701304
 ] 

ASF GitHub Bot commented on KARAF-7678:
---

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 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()` would be based on the OS.





> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-03-13 Thread Ciprian Ciubotariu (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699867#comment-17699867
 ] 

Ciprian Ciubotariu commented on KARAF-7678:
---

An example of the faulty situation: have a table with 1 column with 
{{{}maxSize=15{}}}, and add the contents {{{}"10charword\n10charword"{}}}. This 
should cause the table to have 2 rows, each containing the word 
{{{}10charword{}}}. The previous implementation would cut the original string 
to length 15, leading to contents {{{}"10charword\n10ch"{}}}, even if after 
wrapping the column's {{maxSize}} would have been respected.

> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KARAF-7678) ShellTable erroneously clips out text from multi-line column contents

2023-03-13 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/KARAF-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699864#comment-17699864
 ] 

ASF GitHub Bot commented on KARAF-7678:
---

CMoH opened a new pull request, #1716:
URL: https://github.com/apache/karaf/pull/1716

   Account for multi-line cell contents when calculating cell width and 
clipping the text to maxSize. The cell contents might be either wrapped or 
originally split by the caller with \n characters




> ShellTable erroneously clips out text from multi-line column contents
> -
>
> Key: KARAF-7678
> URL: https://issues.apache.org/jira/browse/KARAF-7678
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.4.3
>Reporter: Ciprian Ciubotariu
>Priority: Minor
>
> The {{ShellTable}} implementation clips column contents to the column's 
> {{maxSize}} before inspecting if the contents is sigle or multi-line. This 
> idea works well with single-line row contents, but it is faulty if the column 
> text contains newlines.
> Given that the newline split is already implemented for the text wrapping 
> function, there is an opportunity for the user to pass multi-line table 
> contents.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)