zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint3@fastmail.com>
To: zsh-workers@zsh.org
Subject: [BUG] Condition in [[ doesn't fire, with "if" it fires
Date: Tue, 28 Feb 2017 03:11:29 -0800	[thread overview]
Message-ID: <1488280289.2878360.895324176.3971EE76@webmail.messagingengine.com> (raw)

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@fastmail.com


             reply	other threads:[~2017-02-28 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 11:11 Sebastian Gniazdowski [this message]
2017-02-28 11:27 ` Sebastian Gniazdowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488280289.2878360.895324176.3971EE76@webmail.messagingengine.com \
    --to=psprint3@fastmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).