select.lua: put track name in directional isolate#17606
select.lua: put track name in directional isolate#17606afishhh wants to merge 1 commit intompv-player:masterfrom
Conversation
c2b1a47 to
62e97c8
Compare
|
|
||
| local function format_track(track) | ||
| local bitrate = track["demux-bitrate"] or track["hls-bitrate"] | ||
| local bidi_fsi = "\226\129\168" -- U+2068 FIRST STRONG ISOLATE |
There was a problem hiding this comment.
I'd put these someplace more global. There could be other places at the OSC which would want to use it.
Also, the casual code reader probably doesn't know what "FIRST STRONG ISOLATE" means, so a comment could help (but "POP DIRECTIONAL ISOLATE" does sound self-describing)
There was a problem hiding this comment.
I'd put these someplace more global. There could be other places at the OSC which would want to use it.
then it can be moved to common place based on required uses.
Also, the casual code reader probably doesn't know what "FIRST STRONG ISOLATE" means
The causal code reader can use google or chatgpt to educate themselves.
There was a problem hiding this comment.
the casual code reader probably doesn't know what "FIRST STRONG ISOLATE" means
Can add a comment pointing to the fine manual spec at https://www.unicode.org/reports/tr9/#Explicit_Directional_Isolates
There was a problem hiding this comment.
This is not the OSC dude
There was a problem hiding this comment.
then it can be moved to common place based on required uses.
Technically, to avoid such random issues in the future, all arbitrary metadata strings should use it. Not just this specific display.
There was a problem hiding this comment.
Technically, to avoid such random issues in the future, all arbitrary metadata strings should use it. Not just this specific display.
Yes, and once this change is created the correct design can be applied to handling this escaping.
Prevents RTL track names from messing up the subtitle select menu where the name is preceded only by neutral characters. Fixes: mpv-player#17605
62e97c8 to
df383d5
Compare
|
Would that work also for bullet and RTL text and without any English text at all? |
|
I would really prefer if there was a comment along the lines of: -- The default text direction is LTR, but it can be RTL depending on content.
-- To isolate arbitrary text so that it doesn't affect the global direction,
-- like in <bullet> <text>, put the text between U+2068 and U+2069. |
|
The scope of this fix is too limited. there are still issues with the context-menu that are known at present #17605 (comment), |
Indeed. This should probably be applied wherever arbitrary strings are used in the UI. This includes the lua menu, maybe all arbitrary metadata strings at |
This also fixes the issue in the context menu because it uses the same function.
Maybe a utility function that wraps some text inside a directional isolate (maybe even handles any rogue PDIs if we care) could make sense but I wouldn't know where to put that and not sure if it makes sense in this PR. |
No, not only the track titles may contain RTL characters, but also the file names. And even the user's menu.conf may be written in RTL language. |
|
|
It's not a problem in libass. That's how Unicode works. It should be fixed in whoever uses libass to display arbitrary strings but wants them to end up primarily LTR. |
I don't know what to do about this and don't use Windows, someone familiar with the Windows context menu should figure out what to do here. I kind of don't want to believe it doesn't support reordering since that'd be very dumb, but it's Windows. Discussion in #17605 suggests we could also achieve stronger isolation by using an ASS trick but that'd obviously not work in the native menu either. So whether we can use that trick also depends on what we do with the Windows context menu. |
What's to figure out? It clearly doesn't handle those codes and display them as-is. I believe LTR/RTL marks works, isolates does not as we can see. |
Right so I should special case Windows to just not do anything then? Since apparently it's already "correct" there (see #17605 (comment), maybe it acts as if paragraph direction was always LTR). |
|
Not sure what is the best approach here. Sounds like we should filter it in |
Windows users can also use the Lua menu by setting |
|
Not related to the native menu problem but another way to make this more foolproof that doesn't involve ASS tricks is just:
https://unicode.org/reports/tr9/#X6a seems carefully designed to allow this to work without footguns (i.e. we don't need to worry about embedding level limits or other unclosed control codes). Even if it doesn't work in all cases we already accept |
Please upvote the issue here: https://aka.ms/AA10adi9 |


Prevents RTL track names from messing up the subtitle select menu where the name is preceded only by neutral characters.
Fixes: #17605