mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
652f09a7a6
commit
3694af6076
|
@ -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 });
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue