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

Re: Bug#270632: zsh: Completion and spaces



> Only that it always disables auto-suffix-removal.  E.g., if $LBUFFER ends 
> in a slash which was added as a completion suffix, and the first character 
> of the word to be inserted is also a slash, then normally the suffix would 
> be deleted in order that the slash not become doubled; but with the work- 
> around, you get the double slash.

That sounds like it's a purely cosmetic problem, but how about this for
the zsh/parameter solution?

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	9 Sep 2004 15:14:21 -0000
@@ -35,13 +35,14 @@
 #   bindkey '\e=' insert-last-assignment
 
 emulate -L zsh
+zmodload -i zsh/parameter || return 1
 setopt extendedglob
 
 # Not strictly necessary:
 # (($+_ilw_hist)) || integer -g _ilw_hist _ilw_count _ilw_cursor _ilw_lcursor
 
 integer cursor=$CURSOR lcursor=$CURSOR
-local lastcmd pattern numeric=$NUMERIC
+local lastc lastcmd pattern numeric=$NUMERIC
 
 # Save state for repeated calls
 if (( HISTNO == _ilw_hist && cursor == _ilw_cursor )); then
@@ -64,10 +65,8 @@
 _ilw_hist=$HISTNO
 _ilw_count=$NUMERIC
 
-zle .up-history || return 1      # Retrieve previous command
-lastcmd=( ${${(z)BUFFER}:#\;} )  # Split into shell words
-zle .down-history                # Return to current command
-CURSOR=$cursor                   # Restore cursor position
+lastc="$history[$#history]"      # Retrieve previous command
+lastcmd=( ${${(z)lastc}:#\;} )   # Split into shell words
 NUMERIC=${numeric:-1}            # In case of fall through
 
 (( NUMERIC > $#lastcmd )) && return 1



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