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

[BUG] Condition in [[ doesn't fire, with "if" it fires



Hello,
I have in code:

        echo "Non-bumped line[${ZUI[log_scroll]}]: $line" >> /tmp/reply
        [[ "${ZUI[log_scroll]}" = "below" ]] && (( line ++ )) || (( line
        = stborder ))
        echo "Bumped line: $line" >> /tmp/reply

It doesn't "bump" in certain situation. However, if I change the
condition to:

        if [[ "${ZUI[log_scroll]}" = "below" ]]; then
            (( line ++ ))
        else
            (( line = stborder ))
        fi

Then it works also in the certain situation. Changing "[[" to "[" (with
no "if") doesn't help. Logs from fault-behavior say:

        Non-bumped line[below]: 0
        Bumped line: 0

So, the condition should fire because of "[below]".


To reproduce: just checkout this branch "debug_zsh_execution":

https://github.com/psprint/zui/tree/debug_zsh_execution

source from zshrc: "source ~/path/zui/zui.plugin.zsh". Then press Ctrl-O
Ctrl-P. An UI will fire and that's all. Now just scroll step by step to
line before "Append third!", like here:

https://asciinema.org/a/1mlc4wnegc6zbrkafv6zudg9z

You will see log messages overwritten, i.e. no (( line ++ )). All other
steps were firing the condition. Checked zsh-5.0.0, zsh-4.3.17, it
behaves identically.

-- 
  Sebastian Gniazdowski
  psprint3@xxxxxxxxxxxx



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