* [Qemu-devel] [PATCH] monitor: Provide empty command as final history entry
@ 2009-03-08 15:26 Jan Kiszka
2009-03-13 15:30 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2009-03-08 15:26 UTC (permalink / raw)
To: qemu-devel
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] monitor: Provide empty command as final history entry
2009-03-08 15:26 [Qemu-devel] [PATCH] monitor: Provide empty command as final history entry Jan Kiszka
@ 2009-03-13 15:30 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2009-03-13 15:30 UTC (permalink / raw)
To: qemu-devel
Jan Kiszka wrote:
> 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>
> ---
>
>
Applied. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-13 15:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-08 15:26 [Qemu-devel] [PATCH] monitor: Provide empty command as final history entry Jan Kiszka
2009-03-13 15:30 ` Anthony Liguori
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).