From 76019e1d527ab8b1634f93ac98daf41165bb91ae Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 21 Jun 2008 14:16:30 +0000 Subject: [PATCH] If one match, add trailing space. --- cmd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd.c b/cmd.c index b119698c..26c36b72 100644 --- a/cmd.c +++ b/cmd.c @@ -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 @@ -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++) {