diff --git a/DOCS/interface-changes/display-page-toggle.txt b/DOCS/interface-changes/display-page-toggle.txt new file mode 100644 index 0000000000..0352821074 --- /dev/null +++ b/DOCS/interface-changes/display-page-toggle.txt @@ -0,0 +1 @@ +add `display-page-n-toggle` script bindings to stats.lua, where n is a page number diff --git a/DOCS/man/stats.rst b/DOCS/man/stats.rst index 0e42f44496..4d22f36ff3 100644 --- a/DOCS/man/stats.rst +++ b/DOCS/man/stats.rst @@ -233,7 +233,7 @@ Additional keys can be configured in ``input.conf`` to display the stats:: And to display a certain page directly:: i script-binding stats/display-page-1 - e script-binding stats/display-page-2 + h script-binding stats/display-page-4-toggle Active key bindings page ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 2d529e8858..bee666467a 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -1750,14 +1750,20 @@ 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}) --- Single invocation bindings without key, can be used in input.conf to create --- bindings for a specific page: "e script-binding stats/display-page-2" for k, _ in pairs(pages) do - mp.add_key_binding(nil, "display-page-" .. k, - function() - curr_page = k - process_key_binding(true) - end, {repeatable=true}) + -- 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() + 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() + curr_page = k + process_key_binding(false) + end, {repeatable=true}) end -- Reprint stats immediately when VO was reconfigured, only when toggled