From 4c0a119557181a5e882679e659bb387d69ef650f Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Fri, 19 Apr 2019 09:40:30 -0700 Subject: [PATCH] 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.) --- src/screen.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/screen.cpp b/src/screen.cpp index 2daee7b4a..341752eae 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -465,17 +465,17 @@ 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 - s->actual.cursor.x = 0; + // 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; } }