Skip to content

Commit 075d8fd

Browse files
committed
when annotation does not have group, default 1
1 parent 980c23e commit 075d8fd

File tree

1 file changed

+11
-1
lines changed
  • src/content_scripts/common

1 file changed

+11
-1
lines changed

src/content_scripts/common/api.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,17 @@ function createAPI(clipboard, insert, normal, hints, visual, front, browser) {
143143
}, new_annotation ? parseAnnotation({ annotation: new_annotation }) : null, false);
144144
normal.mappings.add(KeyboardUtils.encodeKeystroke(new_keystroke), keybound);
145145
} else {
146-
if (!mapInMode(normal, new_keystroke, old_keystroke) && old_keystroke in Mode.specialKeys) {
146+
const map = mapInMode(normal, new_keystroke, old_keystroke);
147+
// update the new annotation
148+
if(map && new_annotation) {
149+
const keys = KeyboardUtils.encodeKeystroke(new_keystroke);
150+
const newMap = normal.mappings.find(keys);
151+
const ano = parseAnnotation({ annotation: new_annotation });
152+
newMap.meta.annotation = ano.annotation;
153+
newMap.meta.feature_group = ano.feature_group ?? 1;
154+
}
155+
156+
if (!map && old_keystroke in Mode.specialKeys) {
147157
Mode.specialKeys[old_keystroke].push(new_keystroke);
148158
dispatchSKEvent('addMapkey', ["Mode", new_keystroke, old_keystroke]);
149159
} else {

0 commit comments

Comments
 (0)