From ed45adcb088f7413033e8eab1444f0810631fbea Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 4 Dec 2022 11:28:03 +1000 Subject: [PATCH] Partially revert #2215 This fixes the issues mentioned on https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/78 I can't seem to reproduce the extra tag being added when auto-completing anymore, but perhaps I'm just not getting the steps right. --- ts/tag-editor/TagEditor.svelte | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ts/tag-editor/TagEditor.svelte b/ts/tag-editor/TagEditor.svelte index 30e50ebc7..40c950040 100644 --- a/ts/tag-editor/TagEditor.svelte +++ b/ts/tag-editor/TagEditor.svelte @@ -125,15 +125,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export function appendEmptyTag(): void { // used by tag badge and tag spacer deselect(); - const tagsHadFocus = active === null; - active = null; - const lastTag = tagTypes[tagTypes.length - 1]; if (!lastTag || lastTag.name.length > 0) { appendTagAndFocusAt(tagTypes.length - 1, ""); } + const tagsHadFocus = active === null; + active = null; + if (tagsHadFocus) { decideNextActive(); } @@ -163,11 +163,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const splitOff = activeName.slice(end); activeName = current; - active = null; // await tag to update its name, so it can normalize correctly await tick(); appendTagAndFocusAt(index, splitOff); + active = null; await tick(); if (index === active) { @@ -292,6 +292,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html break; case "Enter": + autocomplete.chooseSelected(); event.preventDefault(); break; }