reader: Force ONLCR on for fish and external commands

Just like OPOST this just breaks output for anything not prepared for
it. Fish itself might work with it (and #4505 recommends it), but external commands are broken.

You'll see output like

foo
   ⏎

from `echo foo`.

Fixes #4873.

Continuation of #7133.
This commit is contained in:
Fabian Homborg 2021-01-18 21:00:08 +01:00
parent bc6414aaa8
commit 88a84bd988

View File

@ -774,6 +774,8 @@ static void term_fix_modes(struct termios *modes) {
modes->c_lflag &= ~IEXTEN; // turn off handling of discard and lnext characters
modes->c_oflag |= OPOST; // turn on "implementation-defined post processing" - this often
// changes how line breaks work.
modes->c_oflag |= ONLCR; // "translate newline to carriage return-newline" - without
// you see staircase output.
// Disable flow control in the shell. We don't want to be stopped.
modes->c_iflag &= ~IXON;
@ -799,9 +801,10 @@ static void term_fix_modes(struct termios *modes) {
}
static void term_fix_external_modes(struct termios *modes) {
// Turning off OPOST breaks output (staircase effect), we don't allow it.
// Turning off OPOST or ONLCR breaks output (staircase effect), we don't allow it.
// See #7133.
modes->c_oflag |= OPOST;
modes->c_oflag |= ONLCR;
// These cause other ridiculous behaviors like input not being shown.
modes->c_lflag |= ICANON;
modes->c_lflag |= IEXTEN;