Skip to content

Commit

Permalink
Fix windows console mode when closing the terminal, fixes #169
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 10, 2017
1 parent 34f5a5f commit 7b3acf1
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public abstract class AbstractWindowsTerminal extends AbstractTerminal {
protected final ShutdownHooks.Task closer;
protected final Attributes attributes = new Attributes();
protected final Thread pump;
protected final int originalConsoleMode;

protected MouseTracking tracking = MouseTracking.Off;
private volatile boolean closing;
Expand All @@ -80,6 +81,7 @@ public AbstractWindowsTerminal(Writer writer, String name, Charset encoding, int
this.output = new WriterOutputStream(writer, encoding());
parseInfoCmp();
// Attributes
originalConsoleMode = getConsoleMode();
attributes.setLocalFlag(Attributes.LocalFlag.ISIG, true);
attributes.setControlChar(Attributes.ControlChar.VINTR, ctrl('C'));
attributes.setControlChar(Attributes.ControlChar.VEOF, ctrl('D'));
Expand Down Expand Up @@ -210,6 +212,7 @@ public void close() throws IOException {
}
reader.close();
writer.close();
setConsoleMode(originalConsoleMode);
}

static final int SHIFT_FLAG = 0x01;
Expand Down

0 comments on commit 7b3acf1

Please sign in to comment.