[gdb/tui] Delete line buffer when switching to singlekey
authorTom de Vries <tdevries@suse.de>
Fri, 9 Jun 2023 14:39:27 +0000 (16:39 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 9 Jun 2023 14:39:27 +0000 (16:39 +0200)
commit68bb2e3ee06fa4dbf39f95dc76743be5cd5254f5
tree252b4c4ba48cd5c9eae20991cdfb1c5dcd8991bb
parentb3c82d5d2c67c8ef874ac0aa1c5d4558c93393df
[gdb/tui] Delete line buffer when switching to singlekey

Say we're in TUI mode, and type "sun":
...
(gdb) sun
...

After switching to SingleKey mode using C-x s, we have just:
...
sun
...

After typing "d", we get:
...
sun
Undefined command: "sundown".  Try "help".
...

The SingleKey "d" is supposed run the "down" command.

Fix this by clearing the readline line buffer when switching to SingleKey
mode.

Tested on x86_64-linux.

PR tui/30522
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30522

Reviewed-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.tui/single-key-2.exp [new file with mode: 0644]
gdb/tui/tui.c