It is currently April 19th, 2024, 5:37 pm

[BUG?] in Multiple usage of #CURRENTSECTION#

Report bugs with the Rainmeter application and suggest features.
User avatar
Yincognito
Rainmeter Sage
Posts: 7126
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Yincognito »

Brian wrote: July 1st, 2021, 2:32 pmOk. I think I made some progress on this.
Just out of curiosity, because I didn't test it yet (will do though, in a couple of moments) ... does this mean we can also get the current section value from Lua or not?

EDIT: Damn, that works as well now, in all execution stages of a measure with bangs that's using inline Lua or a "custom variable" holding (escaped) inline Lua:

Code: Select all

  cs = SKIN:GetVariable('CURRENTSECTION', 'n/a')
  print(cs)
This is gold, really. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7126
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Yincognito »

Brian wrote: July 1st, 2021, 2:32 pmHere is a special build for everyone to try
-Brian
Maybe this should be tested on the skin described here by Cariboudjan as well, just to make sure it works there too. That problem was related to the !Delay fix, but it also contained some CURRENTSECTION occurences, so just to be on the safe side a test on that skin would be wise to do.

That being said, when this becomes "official" and everything is stable and all, I propose that all of us here (me, ActiveColors, death.crafter) marks the threads related to this where he is the OP as solved (edit first post and choose the green check mark), as a recognition for the effort put by the Rainmeter team into fixing these issues. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7126
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Yincognito »

Test skin for all the scenarios I had or I could think of:
SectionIndex_1.0.0.rmskin
Test.jpg
All bar the harmless initial error at refresh work fine.
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Active Colors »

Brian,
to conclude:
  1. This code works
  2. This code works
  3. This code works
  4. This code works
  5. Second answer from here works
  6. This code works
  7. This code works
  8. This code works
  9. This code works
Good job!! :thumbup:

So far just this needs to be verified if it works with the latest special build.
User avatar
Brian
Developer
Posts: 2679
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Brian »

Thanks everyone for testing this. This fix will be in the next beta.


As described in a previous thread, the fix consisted of "tracking" which section the action belongs to. Before nested syntax was implemented, regular variables used in any option were parsed and evaluated whenever the option was "read". This happens when first loading a skin, and if DynamicVariables=1 is used on the measure/meter. Section variables were also parsed and evaluated at this time EXCEPT on actions. Also, tracking the CURRENTSECTION variable at this time is easy since the measure/meter name is readily available.

Also, actions always parsed and evaluated regular variables (ie. #SomeVariable#) when the action was read - BUT, section variables (ie. [SomeMeasure]) were not evaluated at this time. Section variables were only evaluated when the action was executed.


When nested syntax was introduced, a problem came up with mixing section variables with regular variables. Like [#Variable[&Measure]]. While normal options could parse this, actions had to wait until the action was executed. By this time, the parser is no longer tracking the section name, so the current section variable was basically unavailable for (most) actions.

The fix mainly consists of tracking down all the actions that are fired from a measure/meter and setting current section name just before those actions are parsed just before the action executes.

-Brian
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by death.crafter »

Brian wrote: July 3rd, 2021, 5:52 am
Thank you for taking your time to explain Brian. That made sense.

Now you can rest easy. :P
from the Realm of Death
User avatar
Yincognito
Rainmeter Sage
Posts: 7126
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Yincognito »

Brian wrote: July 3rd, 2021, 5:52 amThe fix mainly consists of tracking down all the actions that are fired from a measure/meter and setting current section name just before those actions are parsed just before the action executes.

-Brian
Thanks for (re)explaning things and dealing with the current section - hopefully it's once and for all. :great:
I'll mark the threads related to this where I'm the OP as solved. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth