Use tui_putc to output newline entered by the user

Message ID 1440173995-1244-1-git-send-email-patrick@parcs.ath.cx
State New, archived
Headers

Commit Message

Patrick Palka Aug. 21, 2015, 4:19 p.m. UTC
  This is necessary to make sure that start_line is updated after a
command has been entered.  Usually, start_line gets updated anyway
because most commands output text, and outputting text is done through
the function tui_puts, which updates start_line.  However if a command
does not output text, then tui_puts will not get called and start_line
will not get updated in time for the next prompt to be displayed.

One can observe this bug by executing the command "delete" within TUI.
After executing, the prompt line

  (gdb) delete

gets overwritten by the next prompt.  With this patch, the prompt line
gets preserved.

[ I extracted this patch out from my series that fixes PR tui/14584
  because it's mostly an independent bugfix.  ]

gdb/ChangeLog:

	* tui/tui-io.c (tui_getc): Use tui_putc instead of waddch to
	emit the newline.
---
 gdb/tui/tui-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Pedro Alves Aug. 21, 2015, 5:52 p.m. UTC | #1
On 08/21/2015 05:19 PM, Patrick Palka wrote:

> gdb/ChangeLog:
> 
> 	* tui/tui-io.c (tui_getc): Use tui_putc instead of waddch to
> 	emit the newline.

OK.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index f0ff5c0..bca1f58 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -606,7 +606,7 @@  tui_getc (FILE *fp)
 	  py += px / TUI_CMD_WIN->generic.width;
 	  px %= TUI_CMD_WIN->generic.width;
 	  wmove (w, py, px);
-	  waddch (w, ch);
+	  tui_putc ('\n');
         }
     }