(from martin.bartlett@club-internet.fr)
JLine doesn't do very well at editing the command line in Windows and I don't have the expertise to fix it (the big problem is editing a line that has wrapped).
Setting the terminal type to "unsupported" fixes the editing but, but produces TWO prompts for each line entered because of the \r\n.
The fault is in readline(InputStream) in ConsoleReader.java - it has a too-simplistic approach to finding the end of a line.
Taking an idea from Java's BufferedReader readline method, the following version of the method fixes the problem:
boolean skipLF;
private String readLine(InputStream in)
throws IOException {
StringBuffer buf = new StringBuffer();
while (true) {
int i = in.read();
if ((i == -1) || (i == '\n') || (i == '\r')) {
if (i == '\n' && skipLF) {
skipLF = false;
continue;
}
if (i == '\r')
skipLF = true;
return buf.toString();
}
buf.append((char) i);
skipLF = false;
}
}
Can someone reformulate this as a patch and see if it works on Windows (and does not break other things)?