[3/3] Don't flush the prompt when resizing the terminal within TUI
Commit Message
This patch removes the ancient code that is responsible for forcing the
prompt to get flushed and executed when tui_getc() detects that the
terminal has been resized. This behavior is unintuitive and seemingly
unnecessary. I tried figuring out why tui_getc() behaves this way, but
git-blame does not reveal anything informative about this code. It
probably has something to do with avoiding to print KEY_RESIZE keys, but
the previous patch prevents that from happening anymore.
gdb/ChangeLog:
* tui/tui-io.c (tui_handle_resize_during_io): Remove parameter.
Change return type to void. Don't call dont_repeat.
(tui_getc): Adjust.
---
gdb/tui/tui-io.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
Comments
On 01/08/2015 04:04 AM, Patrick Palka wrote:
> This patch removes the ancient code that is responsible for forcing the
> prompt to get flushed and executed when tui_getc() detects that the
> terminal has been resized. This behavior is unintuitive and seemingly
> unnecessary. I tried figuring out why tui_getc() behaves this way, but
> git-blame does not reveal anything informative about this code. It
> probably has something to do with avoiding to print KEY_RESIZE keys, but
> the previous patch prevents that from happening anymore.
I don't know why it was found necessary either. I agree it's not intuitive.
Looks good to me.
Thanks,
Pedro Alves
@@ -135,7 +135,7 @@ static int tui_readline_pipe[2];
This may be the main gdb prompt or a secondary prompt. */
static char *tui_rl_saved_prompt;
-static unsigned int tui_handle_resize_during_io (unsigned int);
+static void tui_handle_resize_during_io (void);
static void
tui_putc (char c)
@@ -642,7 +642,8 @@ tui_getc (FILE *fp)
#endif
ch = wgetch (w);
- ch = tui_handle_resize_during_io (ch);
+
+ tui_handle_resize_during_io ();
/* The \n must be echoed because it will not be printed by
readline. */
@@ -709,19 +710,15 @@ tui_getc (FILE *fp)
}
-/* Cleanup when a resize has occured.
- Returns the character that must be processed. */
-static unsigned int
-tui_handle_resize_during_io (unsigned int original_ch)
+/* Cleanup when a resize has occured. */
+
+static void
+tui_handle_resize_during_io (void)
{
if (tui_win_resized ())
{
tui_resize_all ();
tui_refresh_all_win ();
- dont_repeat ();
tui_set_win_resized_to (FALSE);
- return '\n';
}
- else
- return original_ch;
}