1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 17:12:36 +00:00

DOCS/lua: clarify repeatable and complex for add_key_binding

The current documentation lacks clarity regarding the interaction
between the `repeatable` and `complex` options. Through an analysis
of the source code (`player/lua/defaults.lua` and
`player/js/defaults.js`), it was observed that the `repeatable` option
is only meaningful when the `complex` option is not enabled.
Additionally, the `complex` option in the existing documentation is
confusing, actually `fn` can be called on key repeat when `complex` is
`true` and `repeatable` is not `true`.

To address these issues, the documentation for the `repeatable` option
was updated to specify that it only applies when the `complex` option is
not set to `true`. Furthermore, the description of the `complex` and
`event` were revised to acknowledge the occurrence of key repeat events.
This commit is contained in:
gaesa 2024-02-10 17:37:41 +08:00 committed by Dudemanguy
parent 024e49010c
commit d8f4749c34

View File

@ -308,16 +308,17 @@ The ``mp`` module is preloaded, although it can be loaded manually with
``repeatable``
If set to ``true``, enables key repeat for this specific binding.
This option only makes sense when ``complex`` is not set to ``true``.
``complex``
If set to ``true``, then ``fn`` is called on both key up and down
events (as well as key repeat, if enabled), with the first
argument being a table. This table has the following entries (and
may contain undocumented ones):
If set to ``true``, then ``fn`` is called on key down, repeat and up
events, with the first argument being a table. This table has the
following entries (and may contain undocumented ones):
``event``
Set to one of the strings ``down``, ``repeat``, ``up`` or
``press`` (the latter if key up/down can't be tracked).
``press`` (the latter if key up/down/repeat can't be
tracked).
``is_mouse``
Boolean Whether the event was caused by a mouse button.