karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarek Gawor <jga...@gmail.com>
Subject Re: svn commit: r1124287 - /karaf/branches/karaf-2.2.x/shell/console/src/main/java/jline/console/ConsoleReader.java
Date Wed, 18 May 2011 15:09:26 GMT
Yep. I agree.

Jarek

On Wed, May 18, 2011 at 11:03 AM, Guillaume Nodet <gnodet@gmail.com> wrote:
> We need to make sure this is backported in jline2 as at some point we
> should revert back to the official version when it will be released.
> The sources are on github/jline/jline2
>
> On Wednesday, May 18, 2011,  <gawor@apache.org> wrote:
>> Author: gawor
>> Date: Wed May 18 14:42:24 2011
>> New Revision: 1124287
>>
>> URL: http://svn.apache.org/viewvc?rev=1124287&view=rev
>> Log:
>> KARAF-496: Karaf prompt displayed twice on Windows with unsupported terminal
>>
>> Modified:
>>     karaf/branches/karaf-2.2.x/shell/console/src/main/java/jline/console/ConsoleReader.java
>>
>> Modified: karaf/branches/karaf-2.2.x/shell/console/src/main/java/jline/console/ConsoleReader.java
>> URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.2.x/shell/console/src/main/java/jline/console/ConsoleReader.java?rev=1124287&r1=1124286&r2=1124287&view=diff
>> ==============================================================================
>> --- karaf/branches/karaf-2.2.x/shell/console/src/main/java/jline/console/ConsoleReader.java
(original)
>> +++ karaf/branches/karaf-2.2.x/shell/console/src/main/java/jline/console/ConsoleReader.java
Wed May 18 14:42:24 2011
>> @@ -99,6 +99,8 @@ public class ConsoleReader
>>      private String previousSearchTerm = "";
>>
>>      private int searchIndex = -1;
>> +
>> +    private boolean skipLF = false;
>>
>>      public ConsoleReader(final InputStream in, final Writer out, final InputStream
bindings, final Terminal term) throws
>>          IOException
>> @@ -1371,17 +1373,32 @@ public class ConsoleReader
>>      private String readLine(final InputStream in) throws IOException {
>>          StringBuilder buff = new StringBuilder();
>>
>> +        if (skipLF) {
>> +            skipLF = false;
>> +
>> +            int i = streamBuffer.isEmpty() ? in.read() : streamBuffer.remove(0);
>> +
>> +            if (i == -1 || i == '\r') {
>> +                return buff.toString();
>> +            } else if (i == '\n') {
>> +                // ignore
>> +            } else {
>> +                buff.append((char) i);
>> +            }
>> +        }
>> +
>>          while (true) {
>>              int i = streamBuffer.isEmpty() ? in.read() : streamBuffer.remove(0);
>>
>> -            if (i == -1 || i == '\n' || i == '\r') {
>> +            if (i == -1 || i == '\n') {
>>                  return buff.toString();
>> +            } else if (i == '\r') {
>> +                skipLF = true;
>> +                return buff.toString();
>> +            } else {
>> +                buff.append((char) i);
>>              }
>> -
>> -            buff.append((char) i);
>>          }
>> -
>> -        // return new BufferedReader (new InputStreamReader (in)).readLine ();
>>      }
>>
>>      //
>>
>>
>>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
> http://camelone.com/
>

Mime
View raw message