[ https://issues.apache.org/jira/browse/FELIX-6509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17502008#comment-17502008 ]
Guillaume Nodet edited comment on FELIX-6509 at 3/6/22, 8:28 PM: ----------------------------------------------------------------- [~ggrzybek] the problem is located here, at least for the plain gogo shell: [https://github.com/apache/felix-dev/blob/master/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandSessionImpl.java#L333] One possible way would be to use a custom function that would support printing as unicode non printable characters 0x00 -> 0x1f). A better alternative may be found in Karaf by leveraging the jline wcwidth method ([https://github.com/jline/jline3/blob/master/terminal/src/main/java/org/jline/utils/WCWidth.java#L47)] : if the wcwidth of the character is less than 1, print the unicode hex value. was (Author: gnt): @reporter the problem is located here, at least for the plain gogo shell: [https://github.com/apache/felix-dev/blob/master/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandSessionImpl.java#L333] One possible way would be to use a custom function that would support printing as unicode non printable characters 0x00 -> 0x1f). A better alternative may be found in Karaf by leveraging the jline wcwidth method ([https://github.com/jline/jline3/blob/master/terminal/src/main/java/org/jline/utils/WCWidth.java#L47)] : if the wcwidth of the character is less than 1, print the unicode hex value. > Evaluation of subshell String results are wrong on Windows > ---------------------------------------------------------- > > Key: FELIX-6509 > URL: https://issues.apache.org/jira/browse/FELIX-6509 > Project: Felix > Issue Type: Bug > Components: Gogo Runtime > Reporter: Grzegorz Grzybek > Assignee: Guillaume Nodet > Priority: Major > > I'm trying this use case (gogo-runtime 1.1.4): > {noformat} > karaf@root()> "MyTest" toCharArray > [M, y, T, e, s, t] > {noformat} > and it's fine. However, trying this: > {noformat} > karaf@root()> config:property-set -p test test "MyTest" > karaf@root()> config:property-get -p test test > MyTest > karaf@root()> ((config:property-get -p test test)) toCharArray > ]M, y, T, e, s, t, > {noformat} > produces weird result. Actually understandable - the {{\r}} is not trimmed > from the result, so it moves cursor to the beginning of the line, and {{]}} > overwrites initial {{[}}. > the reason [is this > loop|https://github.com/apache/felix-dev/blob/org.apache.felix.gogo.runtime-1.1.4/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Closure.java#L388-L390]: > {code:java} > String s = baos.toString(); > while (!s.isEmpty() && s.charAt(s.length() - 1) == '\n') { > s = s.substring(0, s.length() - 1); > } > {code} > it isn't OS aware. {{\r}} should also be removed (probably affects Mac too). -- This message was sent by Atlassian Jira (v8.20.1#820001)