This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB 8.2.90 available for testing


> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>,  palves@redhat.com,  brobecker@adacore.com,  gdb-patches@sourceware.org
> Date: Thu, 14 Mar 2019 11:32:40 -0600
> 
> The appended patch seems to work ok for me, at the cost of leaving the
> gdb prompt in the TUI console window.
> 
> Tom
> 
> diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
> index ef1e88507aa..f3eb2273e6b 100644
> --- a/gdb/tui/tui-io.c
> +++ b/gdb/tui/tui-io.c
> @@ -631,7 +631,7 @@ gdb_wgetch (WINDOW *win)
>       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");
> +    waddch (win, '\n');
>    return r;
>  }

Works for me, and I think that "cost" is a small one to pay.

However, your change gave me an idea, and I think I came up with a bit
better fix, see below (the patch is again the current HEAD).  With
that, the original problem seems to be fixed, and we still don't
produce redundant lines in the command window.  WDYT?

--- gdb/tui/tui-io.c~6	2019-03-17 14:03:10.448181200 +0200
+++ gdb/tui/tui-io.c	2019-03-17 14:03:53.951772800 +0200
@@ -696,12 +696,6 @@ 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;
 }
 
@@ -928,7 +922,7 @@ tui_getc (FILE *fp)
 
   /* The \n must be echoed because it will not be printed by
      readline.  */
-  if (ch == '\n')
+  if (ch == '\n' || ch == '\r')
     {
       /* When hitting return with an empty input, gdb executes the last
          command.  If we emit a newline, this fills up the command window


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]