FELIX-1803 - Unable to edit or backspace on multiline commands


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@829728 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/pom.xml b/karaf/pom.xml
index c444c96..c7d8d6e 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -88,7 +88,7 @@
         <jansi.version>1.0</jansi.version>
         <jetty.bundle.version>6.1.14_1</jetty.bundle.version>
         <junit.version>3.8.2_1</junit.version>
-        <jline.version>0.9.95.200909100109</jline.version>
+        <jline.version>0.9.95-20091026.080844</jline.version>
         <log4j.version>1.2.14</log4j.version>
         <maven.version>2.0.9</maven.version>
         <mina.version>2.0.0-M6</mina.version>
diff --git a/karaf/shell/console/src/main/java/jline/AnsiWindowsTerminal.java b/karaf/shell/console/src/main/java/jline/AnsiWindowsTerminal.java
index 5a2df14..077ee72 100644
--- a/karaf/shell/console/src/main/java/jline/AnsiWindowsTerminal.java
+++ b/karaf/shell/console/src/main/java/jline/AnsiWindowsTerminal.java
@@ -18,14 +18,21 @@
  */
 package jline;
 
+import org.fusesource.jansi.AnsiConsole;
+import org.fusesource.jansi.WindowsAnsiOutputStream;
+
+import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 
 public class AnsiWindowsTerminal extends WindowsTerminal {
 
+    private boolean ansisupported = checkAnsiSupport();
+
     @Override
     public boolean isANSISupported() {
-        return true;
+        return ansisupported;
     }
 
     @Override
@@ -37,4 +44,17 @@
         return super.readCharacter(in);
     }
 
+    public static boolean checkAnsiSupport() {
+        OutputStream dummy = new ByteArrayOutputStream();
+        OutputStream ansiout = AnsiConsole.wrapOutputStream(dummy);
+        try {
+            dummy.close();
+            ansiout.close();
+        } catch (IOException ignore) {
+        }
+
+        return (ansiout instanceof WindowsAnsiOutputStream);
+
+    }
+
 }