diff options
author | SeaHOH <Seahoh@Gmail.com> | 2025-02-25 14:19:48 +0800 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2025-02-25 08:49:35 +0100 |
commit | 5459b0ff191b88215848f23750900aca0c0c248a (patch) | |
tree | cf4f2021cefdd9f03d3fc9bf1a7a92a4cee710be /player | |
parent | 883b94841a863b90848b9519741b91a6e8fff3d1 (diff) | |
download | mpv-5459b0ff191b88215848f23750900aca0c0c248a.tar.bz2 mpv-5459b0ff191b88215848f23750900aca0c0c248a.tar.xz |
stats.lua: use fixed naming for single invocation key bindings
The names of single invocation key bindings for specific pages will be
changed if defines user key bindings, then original invocation fails.
e.g. : when user defines `key_page_4=F4`, then key binding name
`stats/display-page-4-toggle`
becomes
`stats/display-page-F4-toggle`,
and OSC menu `Help` fails.
Diffstat (limited to 'player')
-rw-r--r-- | player/lua/stats.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 2179b2f070..63e87d0eab 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -1431,12 +1431,12 @@ cache_recorder_timer:kill() -- Current page and <page key>:<page function> mapping curr_page = o.key_page_1 pages = { - [o.key_page_1] = { f = default_stats, desc = "Default" }, - [o.key_page_2] = { f = vo_stats, desc = "Extended Frame Timings", scroll = true }, - [o.key_page_3] = { f = cache_stats, desc = "Cache Statistics" }, - [o.key_page_4] = { f = keybinding_info, desc = "Active Key Bindings", scroll = true }, - [o.key_page_5] = { f = track_info, desc = "Selected Tracks Info", scroll = true }, - [o.key_page_0] = { f = perf_stats, desc = "Internal Performance Info", scroll = true }, + [o.key_page_1] = { idx = 1, f = default_stats, desc = "Default" }, + [o.key_page_2] = { idx = 2, f = vo_stats, desc = "Extended Frame Timings", scroll = true }, + [o.key_page_3] = { idx = 3, f = cache_stats, desc = "Cache Statistics" }, + [o.key_page_4] = { idx = 4, f = keybinding_info, desc = "Active Key Bindings", scroll = true }, + [o.key_page_5] = { idx = 5, f = track_info, desc = "Selected Tracks Info", scroll = true }, + [o.key_page_0] = { idx = 0, f = perf_stats, desc = "Internal Performance Info", scroll = true }, } @@ -1720,17 +1720,17 @@ mp.add_key_binding(nil, "display-stats", function() process_key_binding(true) en mp.add_key_binding(nil, "display-stats-toggle", function() process_key_binding(false) end, {repeatable=false}) -for k, _ in pairs(pages) do +for k, page in pairs(pages) do -- Single invocation key bindings for specific pages, e.g.: -- "e script-binding stats/display-page-2" - mp.add_key_binding(nil, "display-page-" .. k, function() + mp.add_key_binding(nil, "display-page-" .. page.idx, function() curr_page = k process_key_binding(true) end, {repeatable=true}) -- Key bindings to toggle a specific page, e.g.: -- "h script-binding stats/display-page-4-toggle". - mp.add_key_binding(nil, "display-page-" .. k .. "-toggle", function() + mp.add_key_binding(nil, "display-page-" .. page.idx .. "-toggle", function() curr_page = k process_key_binding(false) end, {repeatable=false}) |