From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28469 invoked from network); 22 Sep 1999 22:21:11 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 22 Sep 1999 22:21:11 -0000 Received: (qmail 10378 invoked by alias); 22 Sep 1999 22:21:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8008 Received: (qmail 10371 invoked from network); 22 Sep 1999 22:21:04 -0000 Date: Wed, 22 Sep 1999 23:21:03 +0100 From: Adam Spiers To: zsh-workers@sunsite.auc.dk Subject: Re: PATCH: 3.1.6-pws-4: Re: simulation of dabbrev-expand Message-ID: <19990922232103.B30531@thelonious.new.ox.ac.uk> Reply-To: Adam Spiers Mail-Followup-To: zsh-workers@sunsite.auc.dk References: <19990909133913.A30055@thelonious.new.ox.ac.uk> <990909171104.ZM15814@candle.brasslantern.com> <19990916173409.A17932@thelonious.new.ox.ac.uk> <19990917224455.C3509@thelonious.new.ox.ac.uk> <990918195949.ZM6493@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i In-Reply-To: <990918195949.ZM6493@candle.brasslantern.com> X-URL: http://www.new.ox.ac.uk/~adam/ X-OS: Linux 2.2.9 i686 Bart Schaefer (schaefer@candle.brasslantern.com) wrote: > } > On Sep 9, 1:39pm, Adam Spiers wrote: > } > } Subject: simulation of dabbrev-expand > } > } > } > } It appears to always work fine when grabbing words from history added > } > } by the current shell, but either doesn't work at all, or very > } > } unreliably when you want to grab a word from the saved history. > > I'm finally able to reproduce something like this. [...] > The problem is in zle_tricky.c's use of quietgethist(). With Wayne's new > stuff, the history list may have holes in it, but makecomplistflags() is > trying to iterate over the history by calling quietgethist() on consecutive > integers until it returns nothing -- which happens whenever it encounters > such a hole. Ahhh! Of course! I had looked at quietgethist() but never twigged about the holes. > I think the patch below should take care of this part, but it's possible > that I've done more than was necessary; in particular, the hist.c hunk > may not be needed: it might suffice to call the original quietgethist() > before the loop in makecomplistflags(). It's also possible that calling > up_histent() N times is the wrong thing to do: Should the number passed > to compgen -H specify the number of history entries searched or the range > of history numbers searched? I've interpreted it as the former. I think that's a sensible choice. [snip patch] Bart, you're a hero. This bug has been er, bugging me for ages. Together with Sven's nice duplicate removing options we can finally have the dabbrev-expand behaviour which up till now has been the only aspect of zsh I've found inferior to any other shell. Great work guys :-)