zsh-workers
 help / color / mirror / code / Atom feed
* completion fix
@ 1997-02-07 11:16 Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1997-02-07 11:16 UTC (permalink / raw)
  To: Zsh hackers list

A couple of tests in do_single() looks for menucur (the current menu
completion entry) being set instead of menucmp (the flag for menu
completion), which seems to be necessary since the new completion may
be a menu completion even though no previous menu completion needs to
be removed.  The problem is menucur is not automatically reset, so
that causes the types of problem listed below.  The patch fixes it by
setting menucur to zero when the list is invalidated; I can't see how
this can be wrong, since if the list is invalid menucur is pointing at
garbage (it points into amatches which has just been freed).

% zsh -f
% mkdir foi foi/bar foo
% setopt menucomplete
  # I see some kind soul has decided it's unnecessary to have a
  # pre-defined completion for setopt, probably saving less space than
  # it takes the average user to define it in .zshrc, so I have to
  # type it out by hand.  Thanks.  (That's not the bug.)
% echo fo<TAB>
foi foo
% echo foi/
  #        ^ cursor here.  To see what's in foi with ^D, we need to stop
  # menucompletion, so I type `!<DEL>'; line remains the same.
  # (Actually, I have some binding to do it for me, but it doesn't matter.)
% echo foi/^D
bar/
  # So far so good.  Now I want to complete in foi/, so I type <TAB>
% echo fobar/

Ooops.  The completion code thinks it still has a menu entry to delete
when it inserts the new `bar'.

*** Src/Zle/zle_tricky.c.il	Wed Feb  5 09:31:35 1997
--- Src/Zle/zle_tricky.c	Fri Feb  7 11:22:40 1997
***************
*** 2973,2978 ****
--- 2973,2979 ----
  	    freecompctl(ccmain);
      }
      lastambig = menucmp = showinglist = validlist = 0;
+     menucur = NULL;
  }
  
  /* Get the words from a variable or a compctl -k list. */


-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Completion fix
@ 1996-03-18 20:05 Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1996-03-18 20:05 UTC (permalink / raw)
  To: zsh-workers

Try:

bolyai ~ % compctl -l '' foo
bolyai ~ % compctl -x 's[-]' -k (foo bar) -- bar
bolyai ~ % foo bar -<TAB>

You get no completion.

Here is the fix.

Zoltan

*** Src/zle_tricky.c	1996/03/05 01:44:31	1.24
--- Src/zle_tricky.c	1996/03/17 14:21:13
***************
*** 1834,1839 ****
--- 1834,1840 ----
  	    /* And probably put the command name given to the flag in the
  	       array. */
  	    clwpos++;
+ 	    clwnum++;
  	    incmd = 0;
  	    ops = clwords[ra - 1];
  	    clwords[ra - 1] = cmdstr = ret->subcmd;
***************
*** 1842,1848 ****
  	    cmdstr = clwords[ra];
  	    incmd = !clwpos;
  	    clwords += ra;
- 	    clwnum--;
  	}
  	*compadd = 0;
  	if (ccmain != &cc_dummy)
--- 1843,1848 ----



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-02-07 11:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-02-07 11:16 completion fix Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
1996-03-18 20:05 Completion fix Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).