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

Re: Bug#519535: history expansion: modifier completion missing



On Mar 19,  4:28pm, Mikael Magnusson wrote:
}
} Is it supposed to work here? $PWD:<tab> (it doesn't for me).

I don't think so, but that's probably just an omission.

} It does complete if you write $PWD(:<tab>

That's completing a glob qualifier, not a parameter modifier.  So in
pratice it would first expand $PWD and then attempt to glob it, which
works for $PWD but not for parameter values in general.

} but also in ${PWD(:<tab>

That should probably be considered a bug; it's still completing glob
qualifiers, but ${PWD isn't a valid glob pattern.

} but
} accepting one of the latter produces a syntax error:
} % echo ${PWD(:A)}
} zsh: bad substitution

Not surprising, as it is not valid sytax.

} Also, i get this:
} $PWD(:s-<tab>
} _history_modifiers:34: bad math expression: operand expected at `^-'

Hrm.  $delim[...] is being interpreted as an array reference when it
should be "$delim" followed by a character class pattern.


Index: Completion/Zsh/Type/_history_modifiers
===================================================================
diff -c -r1.1 _history_modifiers
--- _history_modifiers	13 Mar 2008 15:46:07 -0000	1.1
+++ _history_modifiers	19 Mar 2009 16:15:13 -0000
@@ -31,11 +31,11 @@
       fi
       delim=$PREFIX[1]
       compset -p 1
-      if ! compset "[^$delim]#$delim[^$delim]#$delim"; then
-	if compset "[^$delim]#$delim"; then
-	  _message original string
+      if ! compset -P "[^$delim]#$delim""[^$delim]#$delim"; then
+	if compset -P "[^$delim]#$delim"; then
+	  _message "replacement string"
 	else
-	  _message replacement string
+	  _message "original string"
 	fi
 	return
       fi



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