Skip to content

Commit 421bf59

Browse files
authoredOct 24, 2023
Fix cr/lf support in dumb terminals (#877)
1 parent 2af16d8 commit 421bf59

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java

-5
Original file line numberDiff line numberDiff line change
@@ -640,11 +640,6 @@ public String readLine(String prompt, String rightPrompt, MaskingCallback maskin
640640
if (isSet(Option.AUTO_FRESH_LINE)) callWidget(FRESH_LINE);
641641
if (isSet(Option.MOUSE)) terminal.trackMouse(Terminal.MouseTracking.Normal);
642642
if (isSet(Option.BRACKETED_PASTE)) terminal.writer().write(BRACKETED_PASTE_ON);
643-
} else {
644-
// For dumb terminals, we need to make sure that CR are ignored
645-
Attributes attr = new Attributes(originalAttributes);
646-
attr.setInputFlag(Attributes.InputFlag.IGNCR, true);
647-
terminal.setAttributes(attr);
648643
}
649644

650645
callWidget(CALLBACK_INIT);

‎terminal/src/main/java/org/jline/terminal/TerminalBuilder.java

+5
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,11 @@ private Terminal doBuild() throws IOException {
459459
type = getDumbTerminalType(dumb, systemStream);
460460
terminal = new DumbTerminalProvider()
461461
.sysTerminal(name, type, false, encoding, nativeSignals, signalHandler, paused, systemStream);
462+
if (OSUtils.IS_WINDOWS) {
463+
Attributes attr = terminal.getAttributes();
464+
attr.setInputFlag(Attributes.InputFlag.IGNCR, true);
465+
terminal.setAttributes(attr);
466+
}
462467
}
463468
} else {
464469
for (TerminalProvider provider : providers) {

0 commit comments

Comments
 (0)
Please sign in to comment.