diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-21 14:16:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-21 14:16:30 +0000 |
commit | 76019e1d527ab8b1634f93ac98daf41165bb91ae (patch) | |
tree | 3cf6acc4601c2aabfa381d16c82232e596162cfc | |
parent | e70e9513a82a817edf35c86cb8b7f5ff2736c771 (diff) | |
download | rtmux-76019e1d527ab8b1634f93ac98daf41165bb91ae.tar.gz rtmux-76019e1d527ab8b1634f93ac98daf41165bb91ae.tar.bz2 rtmux-76019e1d527ab8b1634f93ac98daf41165bb91ae.zip |
If one match, add trailing space.
-rw-r--r-- | cmd.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: cmd.c,v 1.53 2008-06-21 14:11:39 nicm Exp $ */ +/* $Id: cmd.c,v 1.54 2008-06-21 14:16:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -96,6 +96,13 @@ cmd_complete(const char *s) return (xstrdup(s)); } + /* If an exact match, return it, with a trailing space. */ + if (ARRAY_LENGTH(&list) == 1) { + xasprintf(&s, "%s ", ARRAY_FIRST(&list)); + ARRAY_FREE(&list); + return (s); + } + /* Now loop through the list and find the longest common prefix. */ prefix = xstrdup(ARRAY_FIRST(&list)); for (i = 1; i < ARRAY_LENGTH(&list); i++) { |