Skip to content

Commit

Permalink
when annotation does not have group, default 1
Browse files Browse the repository at this point in the history
  • Loading branch information
metasong committed Oct 5, 2023
1 parent 980c23e commit 075d8fd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/content_scripts/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,17 @@ function createAPI(clipboard, insert, normal, hints, visual, front, browser) {
}, new_annotation ? parseAnnotation({ annotation: new_annotation }) : null, false);
normal.mappings.add(KeyboardUtils.encodeKeystroke(new_keystroke), keybound);
} else {
if (!mapInMode(normal, new_keystroke, old_keystroke) && old_keystroke in Mode.specialKeys) {
const map = mapInMode(normal, new_keystroke, old_keystroke);
// update the new annotation
if(map && new_annotation) {
const keys = KeyboardUtils.encodeKeystroke(new_keystroke);
const newMap = normal.mappings.find(keys);
const ano = parseAnnotation({ annotation: new_annotation });
newMap.meta.annotation = ano.annotation;
newMap.meta.feature_group = ano.feature_group ?? 1;
}

if (!map && old_keystroke in Mode.specialKeys) {
Mode.specialKeys[old_keystroke].push(new_keystroke);
dispatchSKEvent('addMapkey', ["Mode", new_keystroke, old_keystroke]);
} else {
Expand Down

0 comments on commit 075d8fd

Please sign in to comment.