From 2b76996dd5c72a1698050aa81e7002369a40ce50 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Mon, 23 Oct 2023 13:36:12 +0200 Subject: [PATCH] Fix cr/lf --- .../src/main/java/org/jline/reader/impl/LineReaderImpl.java | 5 ----- .../src/main/java/org/jline/terminal/TerminalBuilder.java | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java b/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java index 6f1781ce0..acea4ddd2 100644 --- a/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java +++ b/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java @@ -633,11 +633,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); diff --git a/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java b/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java index 484809b93..13531980f 100644 --- a/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java +++ b/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java @@ -452,6 +452,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) {