Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit PR/54415: Ricky Zhou: libedit stats completions ...



details:   https://anonhg.NetBSD.org/src/rev/3ca9b32e9258
branches:  trunk
changeset: 462210:3ca9b32e9258
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jul 28 09:27:29 2019 +0000

description:
PR/54415: Ricky Zhou: libedit stats completions for non-file completions
Use the proper completion function and account for the character appended
by the function when computing the number of columns.

diffstat:

 lib/libedit/filecomplete.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r a62ebc772aad -r 3ca9b32e9258 lib/libedit/filecomplete.c
--- a/lib/libedit/filecomplete.c        Sun Jul 28 05:28:53 2019 +0000
+++ b/lib/libedit/filecomplete.c        Sun Jul 28 09:27:29 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecomplete.c,v 1.56 2019/07/23 10:18:52 christos Exp $       */
+/*     $NetBSD: filecomplete.c,v 1.57 2019/07/28 09:27:29 christos Exp $       */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.56 2019/07/23 10:18:52 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.57 2019/07/28 09:27:29 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -538,7 +538,7 @@
         * Find out how many entries can be put on one line; count
         * with one space between strings the same way it's printed.
         */
-       cols = (size_t)screenwidth / (width + 1);
+       cols = (size_t)screenwidth / (width + 2);
        if (cols == 0)
                cols = 1;
 
@@ -558,7 +558,7 @@
                                break;
                        (void)fprintf(el->el_outfile, "%s%s%s",
                            col == 0 ? "" : " ", matches[thisguy],
-                               append_char_function(matches[thisguy]));
+                               (*app_func)(matches[thisguy]));
                        (void)fprintf(el->el_outfile, "%-*s",
                                (int) (width - strlen(matches[thisguy])), "");
                }



Home | Main Index | Thread Index | Old Index