Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Yet another completion bugfix
- X-seq: zsh-workers 295
- From: Zefram <A.Main@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Z Shell workers mailing list)
- Subject: Yet another completion bugfix
- Date: Wed, 9 Aug 1995 06:00:14 +0100 (BST)
-----BEGIN PGP SIGNED MESSAGE-----
Yet another fix of something I broke. Thanks to Zoltan for diagnosing
this one. When LIST_AMBIGUOUS is unset and AUTO_LIST is set, and a
completion is ambiguous but has an unambiguous prefix, zsh falls over
on some platforms. The problem is that the unambiguous prefix being
completed requires the completion list to be invalidated, but the
options require the list to be shown. I think these circumstances are
the only ones that cause that problem.
The solution is in two parts: first, extra code in invalidatelist(),
that checks to see if the list is supposed to be shown but hasn't been
yet (showinglist==-2). If that is the case, it calls listmatches()
itself before freeing up the array memory and setting the appropriate
flags. Second, a little special-case code in do_ambiguous() to make
sure showinglist is set *before* invalidatelist() is called, in the
case where it matters. In this patch I also add a sanity check to
listmatches(), so that if this problem recurs it will be immediately
obvious on all platforms. (The error message won't even mess up the
screen!)
-zefram
*** Src/zle_tricky.c.1.19 1995/08/09 04:03:38
--- Src/zle_tricky.c 1995/08/09 04:46:05
***************
*** 3049,3054 ****
--- 3049,3056 ----
void
invalidatelist(void)
{
+ if(showinglist == -2)
+ listmatches();
if(validlist) {
freearray(amatches);
zsfree(rpre);
***************
*** 3179,3184 ****
--- 3181,3187 ----
do_ambiguous(void)
{
int p = (usemenu || ispattern), atend = (cs == we);
+ int inv = 0;
menucmp = 0;
***************
*** 3201,3208 ****
if (ae && !atend)
inststrlen(firstm + strlen(firstm) - ae, 0, ae);
if(ab || (ae && !atend))
! invalidatelist();
if (isset(LISTAMBIGUOUS) && (ab || (ae && !atend))) {
lastambig = 0;
return;
}
--- 3204,3212 ----
if (ae && !atend)
inststrlen(firstm + strlen(firstm) - ae, 0, ae);
if(ab || (ae && !atend))
! inv = 1;
if (isset(LISTAMBIGUOUS) && (ab || (ae && !atend))) {
+ invalidatelist();
lastambig = 0;
return;
}
***************
*** 3212,3217 ****
--- 3216,3223 ----
/* And finally list the matches if needed (and requested). */
if (isset(AUTOLIST) && !amenu && !showinglist)
showinglist = -2;
+ if(inv)
+ invalidatelist();
}
}
***************
*** 3505,3510 ****
--- 3511,3524 ----
int of = (isset(LISTTYPES) && !(haswhat & HAS_MISC));
char **arr, **ap, sav;
int nfpl, nfsl, nlpl, nlsl;
+
+ /* Sanity check */
+ if(!validlist) {
+ trashzle();
+ fputs("BUG: listmatches called with bogus list\n", shout);
+ showinglist = 0;
+ return;
+ }
/* Calculate lengths of prefixes/suffixes to be added */
nfpl = fpre ? nicestrlen(fpre) : 0;
-----BEGIN PGP SIGNATURE-----
Version: 2.6.i
iQBVAgUBMChAz2WJ8JfKi+e9AQHLZwH7BsjFJBxnCCeKZS0cjNLGobufBS/U1AF1
rJLX83icUeBCu7cDAFBSjLcSn0t80Y6Eo6y8Qixl2zMQg2EhjHl++w==
=pwy3
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author