Nicholas, Thanks for your quick reply. The issue I raised last time is solved by this patch :)
Some keys on my keyboard are broken, and my alternate keys sometimes mislead me - sorry if I miss or add letters in my spelling. Before asking the above question, I have submitted my first lua plugin improvement [tmux.nvim](https://github.com/trailblazing/tmux.nvim) to github based on the original tmux 3.4. In order to support the switching of primary and secondary prefixes at will, I have to handle two sets of configurations at the same time, which is why I encountered the above problem. These days I upgraded this plugin based on your update to make it work with both versions of tmux. At present, it has been debugged and I will upload it later. Before this tmux update, I used setenv in the conditional statement branch of tmux to avoid the subsequent branch from overwriting the variable definition in the previous branch. This bypass of complex parsing can only avoid confusion in the final definition (execution phase), but cannot avoid the cross-overlapping between environment variables detected during the parsing process. This can be very confusing for programmers -- I have to repeatedly paste the initialization code to make sure I understand which branch/scope the code block is currently in. In a real scenario, some corner bugs are difficult to track down. This is why a correct parsing process is important. "variable assignment only looks at the most recent scope, so the test=6 is skipped but the inner ones are not" According to this logic, the test program should get test==5, not test==6 (which is another point I'm worried about). After the update, it does get test==5 :) The test==5 in my test was added later, purely for testing purposes -- because the original tmux completely ignores the truth value of the conditional expression of the outer conditional statement -- this is unacceptable. Anyway, the current upgrade meets my needs, thank you very much. In this process, there is another point that I am more confused about: how to print the value of the variable during the parsing process? On Wednesday, November 13, 2024 at 9:42:30 AM UTC Nicholas Marriott wrote: > Yes this is a bug, variable assignment only looks at the most recent > scope, so the test=6 is skipped but the inner ones are not. Try the > attached change please. > > > > > On Wed, 13 Nov 2024 at 06:46, Hugh Young <hughvo...@gmail.com> wrote: > >> Hello Nicolas and other friends, >> Thank you for maintaining tmux -- it's a great composition. >> I just found the group:) Before here I posted an [issue]( >> https://github.com/tmux/tmux/issues/4234) on Tmux's Github page. >> >> I have no experience in how to format the code here. >> Fortunately, the amount of code is not large, and I guess you can barely >> see what I want to express. >> >> > cat t.conf >> >> L1=1 >> L2=1 >> test= >> %if #{L1} >> %if #{L2} >> test=1 >> %else >> test=2 >> %endif >> test=5 >> %else >> %if #{L2} >> test=3 >> %else >> test=4 >> %endif >> test=6 >> %endif >> display -p "test=#{test}" >> >> > tmux source t.conf >> Expected output: >> test=1 >> Actual output: >> test=3 >> tmux -V >> tmux 3.4/3.5a >> >> Is this a design or a bug? >> >> Thank you Nocolas :) >> >> Tuo >> >> -- >> You received this message because you are subscribed to the Google Groups >> "tmux-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to tmux-users+...@googlegroups.com. >> To view this discussion, visit >> https://groups.google.com/d/msgid/tmux-users/CAAJZi8DMFbcB6Z70C7MmBHnRfQUxNynfG2zjbrUg2dPHC4F%3DDw%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/tmux-users/CAAJZi8DMFbcB6Z70C7MmBHnRfQUxNynfG2zjbrUg2dPHC4F%3DDw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "tmux-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+unsubscr...@googlegroups.com. To view this discussion, visit https://groups.google.com/d/msgid/tmux-users/7294b4e0-4e26-4415-a857-f86609253b1en%40googlegroups.com.