Disable cursor_down optimization, but fix to check c_oflag, but c_iflag.

The old commit #3f820f0 "Disable ONLCR mapping of NL output to CR-NL"
incorrectly used c_iflag instead of c_oflag, and I copied that error
in my patch.  Fixed that. However, there seems to be other problems
trying to use "\x1B[A", which I have not tried to debug, so comment that out.

(However, #3f820f0 seems to mostly work if we fix it to use c_oflag.)
This commit is contained in:
Per Bothner 2019-04-19 09:40:30 -07:00 committed by Fabian Homborg
parent 50db10a422
commit 4c0a119557

View file

@ -465,16 +465,16 @@ static void s_move(screen_t *s, int new_x, int new_y) {
if (y_steps < 0) {
str = cursor_up;
} else {
} else if (y_steps > 0) {
str = cursor_down;
if ((shell_modes.c_iflag & ONLCR) != 0
if ((shell_modes.c_oflag & ONLCR) != 0
&& std::strcmp(str, "\n") == 0) { // See GitHub issue #4505.
// Most consoles use a simple newline as the cursor down escape.
// If ONLCR is enabled (which it normally is) this will of course
// also move the cursor to the beginning of the line.
if (std::strcmp(cursor_up, "\x1B[A") == 0) // If VT-style terminal
str = "\x1B[B"; // ... use real cursor-down
else
// We could do:
// if (std::strcmp(cursor_up, "\x1B[A") == 0) str = "\x1B[B";
// else ... but that doesn't work for unknown reasons.
s->actual.cursor.x = 0;
}
}