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

[PATCH] _fc: prevent empty argument removal when expanding $history



A few(thousand) errors flood my screen when completing history -<tab>

_fc:79: division by zero
_fc:79: bad math expression: operator expected at `0 signal.h'
_fc:79: lvalue required
_fc:79: bad math expression: operator expected at `$$'
_fc:79: bad math expression: operator expected at `14346'
_fc:79: bad math expression: operator expected at `zshbuiltin...'
_fc:79: bad math expression: illegal character: '
_fc:79: bad math expression: operand expected at `)'
_fc:79: ')' expected

Due to my HISTFILE having this entry:
: 1431102567:0;

(i don't know why it is there either)
---
 Completion/Zsh/Command/_fc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc
index 1589244..13f2422 100644
--- a/Completion/Zsh/Command/_fc
+++ b/Completion/Zsh/Command/_fc
@@ -75,7 +75,7 @@ if [[ -n $state ]]; then
     _wanted -2V events expl "$state_descr" compadd -M "B:0=" -ld list - \
         "${events[@]%%:*}"
   elif [[ -prefix - ]]; then
-    for num cmd in ${(kv)history}; do
+    for num cmd in "${(@kv)history}"; do
       (( num=num - HISTNO ))
       events+=( $num:$cmd )
     done
-- 
2.4.3



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