- Status Unconfirmed
- Percent Complete
- Task Type Bugs
- Category User Interface → Themes
- Assigned To No-one
- Operating System All players
- Severity Low
- Priority Very Low
- Reported Version Release 3.12
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#12891 - %?if() evaluates enumeration indexes and arbitrary numbers to (number + 1)
When displaying %mp in a theme while playback is stopped, the value 0 (zero) is displayed.
However, to test for “playback stopped”, one has to test:
%?if(%mp, =, 1)
That is, one has to test for (index + 1) in order to return true for any given enumerator index number.
Same problem when testing for an arbitrary number. Example:
%?if(%ss(0, 2, %St(font), number), =, 15)
returns true when the font is set to “14-Nimbus”, and false when the font is set to “15-Adobe-Helvetica”.
When testing a %tag that holds a numerical value though, it works as expected:
%?if(%pv, =, 0)
returns true when volume is set to 0dB.
Fixing this would likely break all existing Rockbox themes. One solution to this, would be to require new / updated themes to include some specific code that “acknowledges” the new behavior.
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
Another possible solution:
Now: Endorse current if() behaviour by documenting it
Soon: Add a ifV2() that works as expected
Then: Declare if() to be deprecated
The problem is that the value (the one you get via %if) is used for conditionals too. A value of 0 in conditionals selects the false branch, which always the most right one. We do not want this for enumerations, where the first value should be the most left one. For this reason 0 changes to 1, 1 to 2, and so on. I understand that this is inconsistent with the value printed. FWIW, I think few (if any) people print the value of %mp, it's always used as conditional to display bitmaps.
Your second example surprises me a lot, though.