Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug#270632: zsh: Completion and spaces
- X-seq: zsh-workers 20343
- From: Clint Adams <schizo@xxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Bug#270632: zsh: Completion and spaces
- Date: Thu, 9 Sep 2004 11:15:52 -0400
- Cc: 270632-submitter@xxxxxxxxxxxxxxx
- In-reply-to: <Pine.LNX.4.61.0409090754020.4924@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20040908115321.GA2417@xxxxxxxxx> <20040908180950.GC25987@xxxxxxxxxxx> <20040908194101.GD2775@xxxxxxxxx> <20040908202633.GA3130@xxxxxxxxxxx> <Pine.LNX.4.61.0409081645470.31752@xxxxxxxxxxxxxxxxxx> <20040908235639.GB6785@xxxxxxxxxxx> <Pine.LNX.4.61.0409090754020.4924@xxxxxxxxxxxxxxxxxx>
> 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