From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] monitor: Provide empty command as final history entry
Date: Sun, 08 Mar 2009 16:26:47 +0100 [thread overview]
Message-ID: <49B3E3B7.8040100@web.de> (raw)
Provide an empty line as last entry in command line history, just like
bash e.g. does.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
readline.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/readline.c b/readline.c
index 9c4b68b..9c500f1 100644
--- a/readline.c
+++ b/readline.c
@@ -196,12 +196,14 @@ static void readline_up_char(ReadLineState *rs)
static void readline_down_char(ReadLineState *rs)
{
- if (rs->hist_entry == READLINE_MAX_CMDS - 1 || rs->hist_entry == -1)
- return;
- if (rs->history[++rs->hist_entry] != NULL) {
+ if (rs->hist_entry == -1)
+ return;
+ if (rs->hist_entry < READLINE_MAX_CMDS - 1 &&
+ rs->history[++rs->hist_entry] != NULL) {
pstrcpy(rs->cmd_buf, sizeof(rs->cmd_buf),
rs->history[rs->hist_entry]);
} else {
+ rs->cmd_buf[0] = 0;
rs->hist_entry = -1;
}
rs->cmd_buf_index = rs->cmd_buf_size = strlen(rs->cmd_buf);
next reply other threads:[~2009-03-08 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-08 15:26 Jan Kiszka [this message]
2009-03-13 15:30 ` [Qemu-devel] [PATCH] monitor: Provide empty command as final history entry Anthony Liguori
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=49B3E3B7.8040100@web.de \
--to=jan.kiszka@web.de \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.