It is currently March 28th, 2024, 7:48 pm

[BUG] ClipString being unreliable in combination with IfMatch.

Report bugs with the Rainmeter application and suggest features.
User avatar
JelleDekkers
Posts: 127
Joined: September 27th, 2017, 6:32 pm
Location: Netherlands

[BUG] ClipString being unreliable in combination with IfMatch.

Post by JelleDekkers »

So I was wondering why my latest version of Sienna 2.0 was not properly clipping a string all of the time. The version before never had this issue, and all I had added was the option to choose the time format for sunrise/set and moonrise/set times. The meter wasn't changed in any way, just the measures for the weather parser. The skin files can be found here. The versions I'm talking about are 12-02 (works fine) and 12-05 (broken).

After a bit of testing, I found out that the cause of the issue is the presence of IfMatch options. Even a single one breaks the ClipString of the meter. I've also tried adding UpdateMeasure and UpdateMeter bangs to the IfMatch actions, but that didn't do anything. As far as I know, it's something I can't explain or fix.

I have the following IfMatch options in my sunrise/set and moonrise/set measures:

Code: Select all

IfMatch=^$
IfMatchAction=[!SetOption mDay0Sunset TimeStamp "2020-01-01T00:00:00+0000"] [!SetOption mDay0Sunset Format "N/A"]
IfNotMatchAction=[!SetOption mDay0Sunset TimeStamp "[*#CurrentSection#*]"] [!SetOption mDay0Sunset Format "[*#TimeFormat24HTime[#[#24HTime]]*]"]
What it's supposed to look like:
Image

What it's not supposed to look like:
Image
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [BUG] ClipString being unreliable in combination with IfMatch.

Post by balala »

JelleDekkers wrote: December 7th, 2020, 11:56 am So I was wondering why my latest version of Sienna 2.0 was not properly clipping a string all of the time. The version before never had this issue, and all I had added was the option to choose the time format for sunrise/set and moonrise/set times. The meter wasn't changed in any way, just the measures for the weather parser. The skin files can be found here. The versions I'm talking about are 12-02 (works fine) and 12-05 (broken).

After a bit of testing, I found out that the cause of the issue is the presence of IfMatch options. Even a single one breaks the ClipString of the meter. I've also tried adding UpdateMeasure and UpdateMeter bangs to the IfMatch actions, but that didn't do anything. As far as I know, it's something I can't explain or fix.
Try reducing a little bit the width of the [Day0MoonPhase] meter, for instance by extracting 12 (which seems to be enough): ClipStringW=(#Scale#*(#Width#-#Padding#*2-6.5*#DetailsIconSize#)-[Day0Sunrise:W]-[Day0Sunset:W]-12)
User avatar
JelleDekkers
Posts: 127
Joined: September 27th, 2017, 6:32 pm
Location: Netherlands

Re: [BUG] ClipString being unreliable in combination with IfMatch.

Post by JelleDekkers »

balala wrote: December 7th, 2020, 9:54 pm Try reducing a little bit the width of the [Day0MoonPhase] meter, for instance by extracting 12 (which seems to be enough): ClipStringW=(#Scale#*(#Width#-#Padding#*2-6.5*#DetailsIconSize#)-[Day0Sunrise:W]-[Day0Sunset:W]-12)
I mean, it works, but it's not the solution I'm looking for. The real question is why it's happening in the first place and why this solution works at all.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: [BUG] ClipString being unreliable in combination with IfMatch.

Post by eclectic-tech »

JelleDekkers wrote: December 7th, 2020, 10:17 pm I mean, it works, but it's not the solution I'm looking for. The real question is why it's happening in the first place and why this solution works at all.
I believe what you are seeing is the container meter for those details (based on a formula involving your #Scale#, #Width#, and #Padding# variables) is limiting the display width, and not displaying the ClipString ellipsis.

I can duplicate the "apparent" failed clipping by setting the variable WIDTH=310 in your original code. The details display is limited to the size of the Container meter dimension, and the moon phase text is not displayed beyond that width, so the ClipString ellipsis is not shown.

I would recommend changing the formula for the width of the [DetailsContainer]section to use only half of the #Padding# variable. This prevents the container from obscuring the ClipString ellipsis display.

Code: Select all

[DetailsContainer]
Meter=Image

W=(#Scale#*(#Width#-#Padding#))
...
There may be other combinations of #Scale#, #Width#, and #Padding# that could reproduce this "failed" appearance, I tried a few to test using only half the #Padding# and that seem to eliminate the issue in all my tests.
User avatar
JelleDekkers
Posts: 127
Joined: September 27th, 2017, 6:32 pm
Location: Netherlands

Re: [BUG] ClipString being unreliable in combination with IfMatch.

Post by JelleDekkers »

eclectic-tech wrote: December 8th, 2020, 2:44 am I believe what you are seeing is the container meter for those details (based on a formula involving your #Scale#, #Width#, and #Padding# variables) is limiting the display width, and not displaying the ClipString ellipsis.

I can duplicate the "apparent" failed clipping by setting the variable WIDTH=310 in your original code. The details display is limited to the size of the Container meter dimension, and the moon phase text is not displayed beyond that width, so the ClipString ellipsis is not shown.

I would recommend changing the formula for the width of the [DetailsContainer]section to use only half of the #Padding# variable. This prevents the container from obscuring the ClipString ellipsis display.

Code: Select all

[DetailsContainer]
Meter=Image

W=(#Scale#*(#Width#-#Padding#))
...
There may be other combinations of #Scale#, #Width#, and #Padding# that could reproduce this "failed" appearance, I tried a few to test using only half the #Padding# and that seem to eliminate the issue in all my tests.
That doesn't seem to be the issue, as taking the meter outside of the container still breaks the ellipses. The problem isn't the width of the meter, but the fact that it fails to show the ellipses. If the actual width of the meter was wrong, the sunrise icon wouldn't be properly placed either since all of the meters are centered in the container. The width is correct, it just fails to show the ellipses.

Example:
Image
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [BUG] ClipString being unreliable in combination with IfMatch.

Post by jsmorley »

If you really think this is a bug, I'd appreciate it if you could package up and attach a .zip or .rmskin with a MINIMAL example that just demonstrates the issue. I have seen a lot of screenshots and snippets with IfMatch actions, but nothing I can just install and see the problem.
User avatar
JelleDekkers
Posts: 127
Joined: September 27th, 2017, 6:32 pm
Location: Netherlands

Re: [BUG] ClipString being unreliable in combination with IfMatch.

Post by JelleDekkers »

jsmorley wrote: December 8th, 2020, 1:34 pm If you really think this is a bug, I'd appreciate it if you could package up and attach a .zip or .rmskin with a MINIMAL example that just demonstrates the issue. I have seen a lot of screenshots and snippets with IfMatch actions, but nothing I can just install and see the problem.
I'll see what I can do.