This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] TUI: rewrite tui_query_hook()
- From: Pedro Alves <palves at redhat dot com>
- To: Patrick Palka <patrick at parcs dot ath dot cx>, Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 08 Jan 2015 13:57:35 +0000
- Subject: Re: [PATCH] TUI: rewrite tui_query_hook()
- Authentication-results: sourceware.org; auth=none
- References: <1420689048-23538-1-git-send-email-patrick at parcs dot ath dot cx> <831tn5760g dot fsf at gnu dot org> <CA+C-WL9PgF4j6mzX7Tytsu8a_rAvzfeVmDLbAxcDFfAAOoep1g at mail dot gmail dot com>
On 01/08/2015 01:42 PM, Patrick Palka wrote:
> On Thu, Jan 8, 2015 at 8:31 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>> From: Patrick Palka <patrick@parcs.ath.cx>
>>> Cc: Patrick Palka <patrick@parcs.ath.cx>
>>> Date: Wed, 7 Jan 2015 22:50:48 -0500
>>>
>>> @@ -80,30 +80,18 @@ tui_query_hook (const char *msg, va_list argp)
>>> echo ();
>>> while (1)
>>> {
>>> - wrap_here (""); /* Flush any buffered output. */
>>> - gdb_flush (gdb_stdout);
>>> + char response[2], answer;
>>>
>>> - fputs_filtered (question, gdb_stdout);
>>> - printf_filtered (_("(y or n) "));
>>> + tui_puts (question);
>>> + tui_puts (_("(y or n) "));
>>>
>>> - wrap_here ("");
>>> - gdb_flush (gdb_stdout);
>>> -
>>> - answer = tui_getc (stdin);
>>> - clearerr (stdin); /* in case of C-d */
>>> - if (answer == EOF) /* C-d */
>>> + if (wgetnstr (win, response, 1) == ERR)
>>
>> Given the latest discussions about buffering, don't you need to call
>> wrefresh after the second tui_puts?
>
> I have been using this patch for a few months locally and have not
> seen any buffering issues.
That's because presently tui_puts always flushes. You'll need it
since the query string doesn't end in a new line. This is exactly
like we have a gdb_flush in defaulted_query after printing the
query question.
> The recently-mentioned issues are mostly
> Windows-related, aren't they? I can add a wrefresh() if that is
> what's needed to prevent potential buffering issues.
Let's leave that either for the buffering patch, or if that patch
goes in before this one, add the flushing call here then. That patch
(or patches..) adds a function to handle the flushing, rather than
calling wrefresh, and you'd want to call that one.
Thanks,
Pedro Alves