History

js: complex key-binding: send also key_text

This is doumented and has been part of the table in lua, but until now not in the JS object. Fixes #13448

Avi Halachmi (:avih) committed 2 years ago

Commit d70c77b1 parent a45518c1 file · +5 −4Browse files

Showing the changes to player/javascript (1 of 1 file). Show all

Unified · Split

player/javascript/defaults.js+5−4
@@ -246,10 +246,10 @@ mp.get_osd_margins = function get_osd_margins() { · 245 unmodified lines
246246 // {cb: fn, forced: bool, maybe input: str, repeatable: bool, complex: bool}
247247 var binds = new_cache();
248248
249−function dispatch_key_binding(name, state, key_name) {
249+function dispatch_key_binding(name, state, key_name, key_text) {
250250 var cb = binds[name] ? binds[name].cb : false;
251251 if (cb) // "script-binding [<script_name>/]<name>" command was invoked
252− cb(state, key_name);
252+ cb(state, key_name, key_text);
253253 }
254254
255255 var binds_tid = 0; // flush timer id. actual id's are always true-thy
@@ -307,11 +307,12 @@ function add_binding(forced, key, name, fn, opts) { · 51 unmodified lines
307307 fn({event: "press", is_mouse: false});
308308 });
309309 var KEY_STATES = { u: "up", d: "down", r: "repeat", p: "press" };
310− key_data.cb = function key_cb(state, key_name) {
310+ key_data.cb = function key_cb(state, key_name, key_text) {
311311 fn({
312312 event: KEY_STATES[state[0]] || "unknown",
313313 is_mouse: state[1] == "m",
314− key_name: key_name || undefined
314+ key_name: key_name || undefined,
315+ key_text: key_text || undefined
315316 });
316317 }
317318 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t