[PATCH 2/2] [gdb/tui] Delete line buffer when switching to singlekey
Tom de Vries
tdevries@suse.de
Fri Jun 9 14:37:48 GMT 2023
On 6/9/23 16:16, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Tom> The SingleKey "d" is supposed run the "down" command.
>
> Tom> Fix this by clearing the readline line buffer when switching to SingleKey
> Tom> mode.
>
> I was wondering if saving and restoring the partial text would be
> better, but honestly this is better than the status quo, and it's not
> clear to me that people switch in and out of SingleKey so much that this
> kind of detail would matter.
>
Thanks for the review.
We can compare behaviour with C-x a:
- type foo on gdb prompt
- now enter TUI by typing C-x a
- exit TUI again by typing the same
- we see "(gdb) foo" but that's just an artifact, see PR30523
- we type space three times and backspace to overwrite the artifact
- we can now type C-x y, and we get again "(gdb) foo", this time
indeed in the readline buffer
So, entering TUI with C-x a kills the prompt line and puts it in the
kill ring. Exiting TUI does not restore it.
I'm not 100% convinced that the choice of kill rather than delete is
intentional either. The comment says:
...
/* Clear the readline in case switching occurred in middle of
something. */
if (rl_end)
rl_kill_text (0, rl_end);
...
So, I opted for a simple delete.
Thanks,
- Tom
> So, seems good.
>
> Reviewed-By: Tom Tromey <tom@tromey.com>
>
> Tom
More information about the Gdb-patches
mailing list