Skip to content

Commit

Permalink
Fix cr/lf support in dumb terminals (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet authored Oct 24, 2023
1 parent 2af16d8 commit 421bf59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,6 @@ public String readLine(String prompt, String rightPrompt, MaskingCallback maskin
if (isSet(Option.AUTO_FRESH_LINE)) callWidget(FRESH_LINE);
if (isSet(Option.MOUSE)) terminal.trackMouse(Terminal.MouseTracking.Normal);
if (isSet(Option.BRACKETED_PASTE)) terminal.writer().write(BRACKETED_PASTE_ON);
} else {
// For dumb terminals, we need to make sure that CR are ignored
Attributes attr = new Attributes(originalAttributes);
attr.setInputFlag(Attributes.InputFlag.IGNCR, true);
terminal.setAttributes(attr);
}

callWidget(CALLBACK_INIT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ private Terminal doBuild() throws IOException {
type = getDumbTerminalType(dumb, systemStream);
terminal = new DumbTerminalProvider()
.sysTerminal(name, type, false, encoding, nativeSignals, signalHandler, paused, systemStream);
if (OSUtils.IS_WINDOWS) {
Attributes attr = terminal.getAttributes();
attr.setInputFlag(Attributes.InputFlag.IGNCR, true);
terminal.setAttributes(attr);
}
}
} else {
for (TerminalProvider provider : providers) {
Expand Down

0 comments on commit 421bf59

Please sign in to comment.