From: Hani Benhabiles <kroosec@gmail.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-trivial@nongnu.org,
lcapitulino@redhat.com, stefanha@redhat.com,
xiawenc@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH] readline: Sort completions before printing them.
Date: Thu, 1 May 2014 15:26:42 +0100 [thread overview]
Message-ID: <1398954402-17826-1-git-send-email-kroosec@gmail.com> (raw)
Signed-off-by: Hani Benhabiles <hani@linux.com>
---
util/readline.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/util/readline.c b/util/readline.c
index 8441be4..8d2a0d3 100644
--- a/util/readline.c
+++ b/util/readline.c
@@ -272,6 +272,11 @@ void readline_set_completion_index(ReadLineState *rs, int index)
rs->completion_index = index;
}
+static int completion_comp(const void *a, const void *b)
+{
+ return strcmp(*(const char **) a, *(const char **) b);
+}
+
static void readline_completion(ReadLineState *rs)
{
int len, i, j, max_width, nb_cols, max_prefix;
@@ -297,6 +302,8 @@ static void readline_completion(ReadLineState *rs)
if (len > 0 && rs->completions[0][len - 1] != '/')
readline_insert_char(rs, ' ');
} else {
+ qsort(rs->completions, rs->nb_completions, sizeof(char *),
+ completion_comp);
rs->printf_func(rs->opaque, "\n");
max_width = 0;
max_prefix = 0;
--
1.8.3.2
next reply other threads:[~2014-05-01 14:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-01 14:26 Hani Benhabiles [this message]
2014-05-05 9:27 ` [Qemu-devel] [Qemu-trivial] [PATCH] readline: Sort completions before printing them Michael Tokarev
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=1398954402-17826-1-git-send-email-kroosec@gmail.com \
--to=kroosec@gmail.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=stefanha@redhat.com \
--cc=xiawenc@linux.vnet.ibm.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).