[PATCH] ui/console: Get tab completion working again in the SDL monitor vc

Cal Peake posted 1 patch 1 year, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/7054816e-99c-7e2-6737-7cf98cc56e2@absolutedigital.net
Maintainers: Gerd Hoffmann <kraxel@redhat.com>
include/ui/console.h | 1 +
ui/console.c         | 1 +
2 files changed, 2 insertions(+)
[PATCH] ui/console: Get tab completion working again in the SDL monitor vc
Posted by Cal Peake 1 year, 8 months ago
Define a QEMU special key constant for the tab key and add an entry for
it in the qcode_to_keysym table. This allows tab completion to work again
in the SDL monitor virtual console, which has been broken ever since the
migration from SDL1 to SDL2.

Signed-off-by: Cal Peake <cp@absolutedigital.net>
---
 include/ui/console.h | 1 +
 ui/console.c         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/ui/console.h b/include/ui/console.h
index c0520c694c..e400ee9fa7 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -70,6 +70,7 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict);
 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
    constants) */
 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
+#define QEMU_KEY_TAB        0x0009
 #define QEMU_KEY_BACKSPACE  0x007f
 #define QEMU_KEY_UP         QEMU_KEY_ESC1('A')
 #define QEMU_KEY_DOWN       QEMU_KEY_ESC1('B')
diff --git a/ui/console.c b/ui/console.c
index e139f7115e..addaafba28 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1368,6 +1368,7 @@ static const int qcode_to_keysym[Q_KEY_CODE__MAX] = {
     [Q_KEY_CODE_PGUP]   = QEMU_KEY_PAGEUP,
     [Q_KEY_CODE_PGDN]   = QEMU_KEY_PAGEDOWN,
     [Q_KEY_CODE_DELETE] = QEMU_KEY_DELETE,
+    [Q_KEY_CODE_TAB]    = QEMU_KEY_TAB,
     [Q_KEY_CODE_BACKSPACE] = QEMU_KEY_BACKSPACE,
 };
 
-- 
2.35.3
Re: [PATCH] ui/console: Get tab completion working again in the SDL monitor vc
Posted by Gerd Hoffmann 1 year, 7 months ago
On Thu, Aug 11, 2022 at 06:01:38PM -0400, Cal Peake wrote:
> Define a QEMU special key constant for the tab key and add an entry for
> it in the qcode_to_keysym table. This allows tab completion to work again
> in the SDL monitor virtual console, which has been broken ever since the
> migration from SDL1 to SDL2.
> 
> Signed-off-by: Cal Peake <cp@absolutedigital.net>

Patch added to queue.

thanks,
  Gerd
Re: [PATCH] ui/console: Get tab completion working again in the SDL monitor vc
Posted by Cal Peake 1 year, 7 months ago
Hi Gerd,

Can you take a look at this and let me know what you think?

Thanks,
-Cal


On Thu, 11 Aug 2022, Cal Peake wrote:

> Define a QEMU special key constant for the tab key and add an entry for
> it in the qcode_to_keysym table. This allows tab completion to work again
> in the SDL monitor virtual console, which has been broken ever since the
> migration from SDL1 to SDL2.
> 
> Signed-off-by: Cal Peake <cp@absolutedigital.net>
> ---
>  include/ui/console.h | 1 +
>  ui/console.c         | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/include/ui/console.h b/include/ui/console.h
> index c0520c694c..e400ee9fa7 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -70,6 +70,7 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict);
>  /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
>     constants) */
>  #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
> +#define QEMU_KEY_TAB        0x0009
>  #define QEMU_KEY_BACKSPACE  0x007f
>  #define QEMU_KEY_UP         QEMU_KEY_ESC1('A')
>  #define QEMU_KEY_DOWN       QEMU_KEY_ESC1('B')
> diff --git a/ui/console.c b/ui/console.c
> index e139f7115e..addaafba28 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1368,6 +1368,7 @@ static const int qcode_to_keysym[Q_KEY_CODE__MAX] = {
>      [Q_KEY_CODE_PGUP]   = QEMU_KEY_PAGEUP,
>      [Q_KEY_CODE_PGDN]   = QEMU_KEY_PAGEDOWN,
>      [Q_KEY_CODE_DELETE] = QEMU_KEY_DELETE,
> +    [Q_KEY_CODE_TAB]    = QEMU_KEY_TAB,
>      [Q_KEY_CODE_BACKSPACE] = QEMU_KEY_BACKSPACE,
>  };
>  
> -- 
> 2.35.3
> 
>