* [BUG] Condition in [[ doesn't fire, with "if" it fires
@ 2017-02-28 11:11 Sebastian Gniazdowski
2017-02-28 11:27 ` Sebastian Gniazdowski
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2017-02-28 11:11 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] Condition in [[ doesn't fire, with "if" it fires
2017-02-28 11:11 [BUG] Condition in [[ doesn't fire, with "if" it fires Sebastian Gniazdowski
@ 2017-02-28 11:27 ` Sebastian Gniazdowski
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Gniazdowski @ 2017-02-28 11:27 UTC (permalink / raw)
To: zsh-workers
Checked that even:
[[ "below" = "below" ]] && (( line ++ )) || (( line = stborder ))
doesn't fire. In the same way. It is the false option that is fired:
echo "Non-bumped line [${ZUI[log_scroll]}] $line" >> /tmp/reply
[[ "below" = "below" ]] && (( line ++ )) || (( line = 10 ))
echo "Bumped line [${ZUI[log_scroll]}] $line" >> /tmp/reply
Non-bumped line [below] 0
Bumped line [below] 10
--
Sebastian Gniazdowski
psprint3@fastmail.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-28 11:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28 11:11 [BUG] Condition in [[ doesn't fire, with "if" it fires Sebastian Gniazdowski
2017-02-28 11:27 ` Sebastian Gniazdowski
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).