qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Dongli Zhang" <dongli.zhang@oracle.com>,
	"Joe Jin" <joe.jin@oracle.com>, "Thomas Huth" <thuth@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Cédric Le Goater" <clg@kaod.org>
Subject: [PULL 01/11] readline: fix hmp completion issue
Date: Thu,  2 Mar 2023 18:41:56 +0100	[thread overview]
Message-ID: <20230302174206.2434673-2-clg@kaod.org> (raw)
In-Reply-To: <20230302174206.2434673-1-clg@kaod.org>

From: Dongli Zhang <dongli.zhang@oracle.com>

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>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 monitor/hmp.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/monitor/hmp.c b/monitor/hmp.c
index 2aa85d3982..fee410362f 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1189,9 +1189,7 @@ static void cmd_completion(MonitorHMP *mon, const char *name, const char *list)
         }
         memcpy(cmd, pstart, len);
         cmd[len] = '\0';
-        if (name[0] == '\0') {
-            readline_add_completion_of(mon->rs, name, cmd);
-        }
+        readline_add_completion_of(mon->rs, name, cmd);
         if (*p == '\0') {
             break;
         }
@@ -1335,9 +1333,7 @@ static void monitor_find_completion_by_table(MonitorHMP *mon,
             /* block device name completion */
             readline_set_completion_index(mon->rs, strlen(str));
             while ((blk = blk_next(blk)) != NULL) {
-                if (str[0] == '\0') {
-                    readline_add_completion_of(mon->rs, str, blk_name(blk));
-                }
+                readline_add_completion_of(mon->rs, str, blk_name(blk));
             }
             break;
         case 's':
-- 
2.39.2



  reply	other threads:[~2023-03-02 17:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 17:41 [PULL 00/11] aspeed queue Cédric Le Goater
2023-03-02 17:41 ` Cédric Le Goater [this message]
2023-03-02 17:41 ` [PULL 02/11] hw/i2c: only schedule pending master when bus is idle Cédric Le Goater
2023-03-02 17:41 ` [PULL 03/11] hw/misc: add a toy i2c echo device Cédric Le Goater
2023-03-02 17:41 ` [PULL 04/11] tests/avocado/machine_aspeed.py: Add an I2C slave test Cédric Le Goater
2023-03-02 17:42 ` [PULL 05/11] hw/arm/aspeed: Adding new machine Yosemitev2 in QEMU Cédric Le Goater
2023-03-02 17:42 ` [PULL 06/11] hw/arm/aspeed: Adding new machine Tiogapass " Cédric Le Goater
2023-03-02 17:42 ` [PULL 07/11] hw/at24c : modify at24c to support 1 byte address mode Cédric Le Goater
2023-03-02 17:42 ` [PULL 08/11] aspeed/fuji : correct the eeprom size Cédric Le Goater
2023-03-02 17:42 ` [PULL 09/11] aspeed: Introduce a spi_boot region under the SoC Cédric Le Goater
2023-03-02 17:42 ` [PULL 10/11] aspeed: Add a boot_rom overlap region in the SoC spi_boot container Cédric Le Goater
2023-03-02 17:42 ` [PULL 11/11] aspeed/smc: Replace SysBus IRQs with GPIO lines Cédric Le Goater
2023-03-03 13:23 ` [PULL 00/11] aspeed queue Cédric Le Goater
2023-03-03 13:34   ` Peter Maydell
2023-03-03 14:08     ` Cédric Le Goater
2023-03-03 14:28       ` Peter Maydell
2023-03-04 14:00 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230302174206.2434673-2-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=armbru@redhat.com \
    --cc=dongli.zhang@oracle.com \
    --cc=joe.jin@oracle.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).