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

Global arrays in widgets



Hello,
I do typical trick to detect consecutive widget calls:

typeset -g __zew_csw_index __zew_csw_left __zew_csw_right
typeset -ga __zew_csw_found

if [ "$WIDGET" = "$LASTWIDGET" ]; then
    (( __zew_csw_index ++ ))
else
    (( __zew_csw_index = 1 ))
    __zew_csw_left=...some initial value...
    __zew_csw_right=...some initial value...
    __zew_csw_found=( )
fi

But the variable __zew_csw_found doesn't survive between calls. I
tested various things and found that the only array that I can keep
between calls is reply. Why?

Best regards,
Sebastian Gniazdowski



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