diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-07-20 18:03:29 +0300 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2021-07-25 15:08:44 +0300 |
commit | 955736b7b74d6609dfcf2e349cd227ccf5745899 (patch) | |
tree | bafd6b1c7ca470e1a947de9f4283d2aaa48e1891 /LICENSE.GPL | |
parent | e2109b606bda8f4dae51e4d2006f41b20a29486c (diff) | |
download | mpv-955736b7b74d6609dfcf2e349cd227ccf5745899.tar.bz2 mpv-955736b7b74d6609dfcf2e349cd227ccf5745899.tar.xz |
stats.lua: fix ass-escape while persistent_overlay=yes
mpv has two methods to display output from text input:
- show-text (scripting: mp.osd_message) has ass disabled by default
(escaped), and the property osd-ass-cc can control escaping.
- osd-overlay (scripting: mp.set_osd_ass or mp.create_osd_overlay)
has ass enabled (unescaped), and osd-ass-cc is NOT supported.
By default, stats.lua uses mp.osd_message which does support escaping.
That's persistent_overlay=no.
When using persistent_overlay=yes then mp.set_osd_ass is used.
Due to this, the no_ASS(..) function - which is supposed to escape
ass, simply returned its input unmodified when persistent_overlay
is enabled.
This is not a new issue, and the filters on page 1 use no_ASS() to no
avail in persistent mode, however, this content (filter name and value
strings) rarely actually needs escaping, and users didn't notice.
However, the new page 4 (keys) does break visibly when no_ASS doesn't
work, because it tries to escape arbitrary key-names and command
strings, and at the very least the key '{' is bound by default, which
is displayed incorrectly if escaping doesn't work.
Fix this by rolling our own escaping when using mp.set_osd_ass,
similar to how the mpv code does it for mp.osd_message (substrings
replacements).
However, this means that the set_ASS(..) function can no longer
behave correctly because escaping requires going through the whole
content string rather than only inserting a marker.
Luckily, other than at no_ASS, set_ASS was only used at one place
(text_style), which is only called from two places:
- generate_graph() only needs to restore styles - not to enable ass.
- add_header() is only used at the begining of page output, and
uses set_ASS to enable ass initially when using mp.osd_message.
So remove the set_ASS function, and instead enable ass directly at
print_page using osd-ass-cc when mp.osd_message is used.
Fixes #9022
Diffstat (limited to 'LICENSE.GPL')
0 files changed, 0 insertions, 0 deletions