Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: History !# substitutions



schaefer@xxxxxxxxxxxxxxxxxxxxxxx wrote:
> zigzag% echo foo bar !#:1 ba<TAB>
> [BEEP][cursor doesn't move]
> 
> Much better, but still not perfect.  I realize it probably can't expand
> to the correct word, but could it at least ignore the history error and
> continue completing stuff on the rest of the line?

I think a judicious `stophist = 1' in get_comp_string() should fix this.
At this point, any valid history expansion has been done, and the
lexrestore() will fix up the real history, so this should be pretty
harmless otherwise.


I changed the code, then found there was a bug in menu completion:
hitting tab repeatedly added an extra space each time.  Then I tried
it with the old version and discovered it was there anyway.  Has this
been reported and fixed while I was asleep?

% setopt menucomplete
% print zle<TAB><TAB><TAB><TAB><TAB><Ctrl-e>

produces

% print zle_misc.c     _
                       ^ cursor here.

This is something to do with the code in do_single() around line 3343 of
zle_tricky.c where something called singlec is used to determine
whether a space or slash should be added.  I don't know enough about
what this does to fix it.


Here's the (probably correct, as far as patches to zle_tricky.c go
:-/) patch for ignoring previous history entries when completing.

*** Src/zle_tricky.c.hstop	Thu May 30 10:18:25 1996
--- Src/zle_tricky.c	Thu May 30 10:19:43 1996
***************
*** 936,941 ****
--- 936,942 ----
      lexsave();
      inpush(dupstrspace((char *) linptr), 0);
      strinbeg();
+     stophist = 1;
      pushheap();
      heapalloc();
      i = tt0 = cp = rd = 0;

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




Messages sorted by: Reverse Date, Date, Thread, Author