All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] readline: Sort completions before printing them.
@ 2014-05-01 14:26 Hani Benhabiles
  2014-05-05  9:27 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Hani Benhabiles @ 2014-05-01 14:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, qemu-trivial, lcapitulino, stefanha, xiawenc

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] readline: Sort completions before printing them.
  2014-05-01 14:26 [Qemu-devel] [PATCH] readline: Sort completions before printing them Hani Benhabiles
@ 2014-05-05  9:27 ` Michael Tokarev
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2014-05-05  9:27 UTC (permalink / raw)
  To: Hani Benhabiles, qemu-devel
  Cc: kwolf, qemu-trivial, lcapitulino, stefanha, xiawenc

Applied to -trivial, thank you!

/mjt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-05  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-01 14:26 [Qemu-devel] [PATCH] readline: Sort completions before printing them Hani Benhabiles
2014-05-05  9:27 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev

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.