Fix placement of output in TUI mode
authorTom Tromey <tom@tromey.com>
Sat, 12 Jan 2019 20:35:06 +0000 (13:35 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 14 Jan 2019 23:17:17 +0000 (16:17 -0700)
The fix for PR tui/28819 regressed gdb command output a bit.  In
"nonl" mode, pressing the Enter key will result in a newline not being
echoed properly, so that gdb output for the command will begin on the
same line as the input.

This patch changes gdb_wgetch to echo the newline.  I have only tested
this interactively, as the TUI doesn't have automated tests in
general.

gdb/ChangeLog
2019-01-14  Tom Tromey  <tom@tromey.com>

PR tui/28819:
* tui/tui-io.c (gdb_wgetch): Print \r when needed.

gdb/ChangeLog
gdb/tui/tui-io.c

index 384792c..d887e06 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-14  Tom Tromey  <tom@tromey.com>
+
+       PR tui/28819:
+       * tui/tui-io.c (gdb_wgetch): Print \r when needed.
+
 2019-01-14  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
 
        * ppc-tdep.h (struct gdbarch_tdep) <ppc_v0_alias_regnum>: New
index 0e53350..9191cca 100644 (file)
@@ -609,6 +609,12 @@ gdb_wgetch (WINDOW *win)
   nonl ();
   int r = wgetch (win);
   nl ();
+  /* In nonl mode, if the user types Enter, it will not be echoed
+     properly.  This will result in gdb output appearing immediately
+     after the command.  So, if we read \r, emit a \r now, after nl
+     mode has been re-entered, so that the output looks correct.  */
+  if (r == '\r')
+    puts ("\r");
   return r;
 }