zsh-workers
 help / color / mirror / code / Atom feed
* matching control to ignore initial zeros on numbers
@ 2015-01-25  0:29 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2015-01-25  0:29 UTC (permalink / raw)
  To: Zsh workers

Just as I hit send on the last message, it occurred to me that perhaps
matching control can be used to ignore initial zeroes on numbers.

Using -M "B:0=" does seem to work. I'm not quite sure I understand why
it ignores multiple zeroes but that's what we want anyway.
Have I perhaps missed something with this?

Oliver

diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc
index 08806d3..1331456 100644
--- a/Completion/Zsh/Command/_fc
+++ b/Completion/Zsh/Command/_fc
@@ -69,10 +69,9 @@ if [[ -n $state ]]; then
   if [[ -z ${line:#*=*} ]] && compset -P '*='; then
     _message -e replacements 'replacement'
   elif [[ -prefix [0-9] ]]; then
-    compset -P '0##' # allows initial 0 to force this style
     events=( ${(ps.\0.)"$(printf '%s:%s\0' ${(kv)history})"} )
     zformat -a list " -- " "$events[@]"
-    _wanted -2V events expl "$state_descr" compadd -ld list - \
+    _wanted -2V events expl "$state_descr" compadd -M "B:0=" -ld list - \
         "${events[@]%%:*}"
   elif [[ -prefix - ]]; then
     for num cmd in ${(kv)history}; do


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-25  0:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-25  0:29 matching control to ignore initial zeros on numbers Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).