summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2022-06-23 16:42:23 +0300
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2022-06-23 17:16:33 +0300
commit3694af60769a58d491011ea42f208ffcb7181d9a (patch)
tree48c8e289713c3a4a7c8615295bcd06f37707791d
parent652f09a7a6665be2a04ff8ec4f741de435bd536f (diff)
downloadmpv-3694af60769a58d491011ea42f208ffcb7181d9a.tar.bz2
mpv-3694af60769a58d491011ea42f208ffcb7181d9a.tar.xz
js: key bindings: ensure priorities for same-key - again
Commit 7f4841ff sorted the bindings so that if the same key was bound more than once, then the newest binding takes priority (sorted last). However, it got the comparison function wrong, which means the result of the sort depended on the algorithm and not on the actual data, so the priority for keys with more than one binding was still arbitraty. Fix the sort function, and finally ensure that later binding acutally override earlier bindings of the same key.
-rw-r--r--player/javascript/defaults.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/player/javascript/defaults.js b/player/javascript/defaults.js
index a938ffef65..d906ec2448 100644
--- a/player/javascript/defaults.js
+++ b/player/javascript/defaults.js
@@ -277,7 +277,7 @@ function dispatch_key_binding(name, state, key_name) {
var binds_tid = 0; // flush timer id. actual id's are always true-thy
mp.flush_key_bindings = function flush_key_bindings() {
function prioritized_inputs(arr) {
- return arr.sort(function(a, b) { return a.id > b.id })
+ return arr.sort(function(a, b) { return a.id - b.id })
.map(function(bind) { return bind.input });
}