Skip to content

Commit

Permalink
fixes #2032 ; however still would benefit from jline3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Sep 14, 2024
1 parent 1ce9e59 commit 32824f7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/org/rascalmpl/repl/TerminalProgressBarMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,16 @@ static int getCursorPosition(PrintWriter writer, InputStream in) throws IOExcept

byte[] col = new byte[32];
int len = in.read(col);
String echo = new String(col, 0, len, Configuration.getEncoding());
String echo;

try {
echo = new String(col, 0, len, Configuration.getEncoding());
}
catch (StringIndexOutOfBoundsException e) {
// this happens if there is some other input on stdin (for example a pipe)
// TODO: the input is now read and can't be processed again.
echo = "";
}

if (!echo.startsWith("\u001B[") || !echo.contains(";")) {
return -1;
Expand Down

0 comments on commit 32824f7

Please sign in to comment.