Fix yet another bug in the shipped version of vcs_info()
[grml-etc-core.git] / etc / zsh / zshrc
index 352bd33..cb911c1 100644 (file)
@@ -1417,17 +1417,21 @@ VCS_INFO_formats () { # {{{
         (( ${#msgs} < 1 )) && msgs[1]=' (%s)-[%b]-'
     fi
 
-    (( ${#msgs} > maxexports )) && msgs[${maxexports},-1]=()
+    (( ${#msgs} > maxexports )) && msgs[$(( maxexports + 1 )),-1]=()
     for i in {1..${#msgs}} ; do
-        zformat -f msg ${msgs[$i]} a:${action} b:${branch} s:${vcs} r:${base:t} R:${base} S:"$(VCS_INFO_reposub ${base})"
+        zformat -f msg ${msgs[$i]}                      \
+                        a:${action}                     \
+                        b:${branch}                     \
+                        r:${base:t}                     \
+                        s:${vcs}                        \
+                        R:${base}                       \
+                        S:"$(VCS_INFO_reposub ${base})"
         msgs[$i]=${msg}
     done
     return 0
 }
 # }}}
 VCS_INFO_maxexports () { #{{{
-    local -ix maxexports
-
     zstyle -s ":vcs_info:${vcs}:${usercontext}" "max-exports" maxexports || maxexports=2
     if [[ ${maxexports} != <-> ]] || (( maxexports < 1 )); then
         printf 'vcs_info(): expecting numeric arg >= 1 for max-exports (got %s).\n' ${maxexports}
@@ -1859,6 +1863,7 @@ vcs_info () { # {{{
     local -i found
     local -a VCSs disabled dps
     local -x vcs usercontext
+    local -ix maxexports
     local -ax msgs
     local -Ax vcs_comm