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

Re: Bug#270632: zsh: Completion and spaces



* Clint Adams <schizo@xxxxxxxxxx> [2004-09-08 16:26-0400]
> > Oh, you're right. It's not insert-last-word which is the culprit, but
> > smart-insert-last-word.
> > 
> > I have done:
> > 
> >   autoload smart-insert-last-word
> >   zle -N insert-last-word smart-insert-last-word
> > 
> > With this, you should be able to witness the problem.
> 
> Is this the correct fix?
> 
> Index: Functions/Zle/smart-insert-last-word
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Functions/Zle/smart-insert-last-word,v
> retrieving revision 1.2
> diff -u -r1.2 smart-insert-last-word
> --- Functions/Zle/smart-insert-last-word	27 Jan 2003 16:41:17 -0000	1.2
> +++ Functions/Zle/smart-insert-last-word	8 Sep 2004 20:25:14 -0000
> @@ -86,5 +86,5 @@
>  	fi
>      done
>  fi
> -LBUFFER[lcursor+1,cursor+1]=$lastcmd[-NUMERIC]
> +LBUFFER[lcursor+1,cursor+1]=" $lastcmd[-NUMERIC]"
>  _ilw_cursor=$CURSOR

Your patch fixes the issue with a minor other issue, which is purely
cosmetic.

This always insert a space, whether it's needed or not. Basically,
with my original scenario:

  hugo@buena /tmp% touch test
  hugo@buena /tmp% alias myfoobarcat=cat
  hugo@buena /tmp% cat test

Then:

  hugo@buena /tmp% myfoob[]

Tab:

  hugo@buena /tmp% myfoobarcat []

smart-insert-last-word:

  hugo@buena /tmp% myfoobarcat test[]

smart-insert-last-word again:

  hugo@buena /tmp% myfoobarcattest  myfoobarcat=cat[]

So the first call to smart-insert-last-word did put a space between
myfoobarcat and test, but the second call added another leading space
between myfoobarcattest and myfoobarcat=cat. This extra space should
only be added if the previous word was generated by a completion
function, FWICT.

Again, this is purely cosmetic IMO.

Regards,

Hugo

-- 
Hugo Haas - http://larve.net/people/hugo/

Attachment: signature.asc
Description: Digital signature



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