public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix placement of output in TUI mode
@ 2019-01-12 20:40 Tom Tromey
  2019-01-14 15:13 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2019-01-12 20:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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-12  Tom Tromey  <tom@tromey.com>

	PR tui/28819:
	* tui/tui-io.c (gdb_wgetch): Print \r when needed.
---
 gdb/ChangeLog    | 5 +++++
 gdb/tui/tui-io.c | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 0e53350820..9191ccae7e 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -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;
 }
 
-- 
2.17.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix placement of output in TUI mode
  2019-01-12 20:40 [PATCH] Fix placement of output in TUI mode Tom Tromey
@ 2019-01-14 15:13 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2019-01-14 15:13 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 01/12/2019 08:40 PM, Tom Tromey wrote:
> 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-12  Tom Tromey  <tom@tromey.com>
> 
> 	PR tui/28819:
> 	* tui/tui-io.c (gdb_wgetch): Print \r when needed.

Yes, please.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-14 15:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-12 20:40 [PATCH] Fix placement of output in TUI mode Tom Tromey
2019-01-14 15:13 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).