]> git.ipfire.org Git - thirdparty/qemu.git/commit
readline: fix hmp completion issue
authorDongli Zhang <dongli.zhang@oracle.com>
Tue, 7 Feb 2023 04:52:41 +0000 (20:52 -0800)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 1 Mar 2023 19:46:07 +0000 (20:46 +0100)
commit76f5801a836504b21cf71e93d5a522d92cb435ca
tree13f2c18897bf48a7eaf0ce40e70c88d0937e2600
parent627634031092e1514f363fd8659a579398de0f0e
readline: fix hmp completion issue

The auto completion does not work in some cases.

Case 1.

1. (qemu) info reg
2. Press 'Tab'.
3. It does not auto complete.

Case 2.

1. (qemu) block_resize flo
2. Press 'Tab'.
3. It does not auto complete 'floppy0'.

Since the readline_add_completion_of() may add any completion when
strlen(pfx) is zero, we remove the check with (name[0] == '\0') because
strlen() always returns zero in that case.

Fixes: 52f50b1e9f8f ("readline: Extract readline_add_completion_of() from monitor")
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Message-Id: <20230207045241.8843-1-dongli.zhang@oracle.com>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
monitor/hmp.c