From owner-svn-src-all@FreeBSD.ORG Tue Jun 15 21:00:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C8511065670; Tue, 15 Jun 2010 21:00:54 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C7188FC20; Tue, 15 Jun 2010 21:00:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5FL0rBF092627; Tue, 15 Jun 2010 21:00:53 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5FL0r06092626; Tue, 15 Jun 2010 21:00:53 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201006152100.o5FL0r06092626@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 15 Jun 2010 21:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209217 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2010 21:00:54 -0000 Author: jilles Date: Tue Jun 15 21:00:53 2010 New Revision: 209217 URL: http://svn.freebsd.org/changeset/base/209217 Log: libedit: Fix a bug that could make completion listings incomplete. The element matches[0] is the common prefix and is not counted in len, so subtracting 1 is not needed. A counter for the number of matches per line was incremented twice. Submitted by: Guy Yur Modified: head/lib/libedit/filecomplete.c Modified: head/lib/libedit/filecomplete.c ============================================================================== --- head/lib/libedit/filecomplete.c Tue Jun 15 19:28:44 2010 (r209216) +++ head/lib/libedit/filecomplete.c Tue Jun 15 21:00:53 2010 (r209217) @@ -347,13 +347,12 @@ fn_display_match_list(EditLine *el, char count++; /* Sort the items if they are not already sorted. */ - qsort(&matches[1], (size_t)(len - 1), sizeof(char *), - _fn_qsort_string_compare); + qsort(&matches[1], len, sizeof(char *), _fn_qsort_string_compare); idx = 1; for(; count > 0; count--) { int more = limit > 0 && matches[0]; - for(i = 0; more; i++, idx++) { + for(i = 0; more; idx++) { more = ++i < limit && matches[idx + 1]; (void)fprintf(el->el_outfile, "%-*s%s", (int)max, matches[idx], more ? " " : "");