From ff054ce302f8bc803bfa59c7b57fb899ffa4ce11 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 14 Jul 2021 23:21:38 +0100 Subject: [PATCH] script: Fix handling of mixed actions (clashing keystrokes) Signed-off-by: Ian Jackson --- templates/script.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index fe80192d..48c10157 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -410,8 +410,12 @@ function recompute_keybindings() { }); var uo_keys = Object.keys(uo_map); uo_keys.sort(function (ak,bk) { - let a = uo_map[ak]!; - let b = uo_map[bk]!; + let a = uo_map[ak]; + let b = uo_map[bk]; + if (a==null || b==null) return ( + ( (!!a) as any ) - + ( (!!b) as any ) + ); return uo_kind_prec[a.kind] - uo_kind_prec[b.kind] || ak.localeCompare(bk); }); @@ -426,7 +430,8 @@ function recompute_keybindings() { else celem.remove(); } for (var kk of uo_keys) { - let uo = uo_map[kk]!; + let uo = uo_map[kk]; + if (!uo) continue; let prec = uo_kind_prec[uo.kind]; let ent = document.createElement('div'); ent.innerHTML = '' + kk + ' ' + uo.desc; -- 2.30.2