tags: issues with nonbreaking-space mutations
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Start with libanki/src/test/java/com/ichi2/anki/libanki/TagNonbreakingSpaceRegressionTest.kt and run the two regression tests. They reproduce incorrect tag rename and delete behavior for tags containing U+00A0; both are currently ignored because the backend TagMatcher mishandles that character. Trace the matcher from the tag rename and removal entry points, then confirm both tests pass and preserve the unrelated ab tag.
Written by the indexing model from the issue text.
Description
From 4f6281dc34b8a35d53c017b39f8935267e980bce Mon Sep 17 00:00:00 2001
From: David Allison <[email protected]>
Date: Thu, 12 Nov 2026 15:28:50 +0000
Subject: [PATCH] test(tags): cover nonbreaking-space mutations
Reproduce backend rename and delete matching ab when asked to change a
tag containing an interior U+00A0. Check both note tags and the tag cache.
Both tests fail against the current backend and remain explicitly ignored
until its TagMatcher preserves whitespace literally.
Assisted-by: GPT-6-Astra xhigh
---
.../TagNonbreakingSpaceRegressionTest.kt | 37 +++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 libanki/src/test/java/com/ichi2/anki/libanki/TagNonbreakingSpaceRegressionTest.kt
diff --git a/libanki/src/test/java/com/ichi2/anki/libanki/TagNonbreakingSpaceRegressionTest.kt b/libanki/src/test/java/com/ichi2/anki/libanki/TagNonbreakingSpaceRegressionTest.kt
new file mode 100644
index 0000000000..6baca2d973
--- /dev/null
+++ b/libanki/src/test/java/com/ichi2/anki/libanki/TagNonbreakingSpaceRegressionTest.kt
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package com.ichi2.anki.libanki
+
+import com.ichi2.anki.libanki.testutils.InMemoryAnkiTest
+import org.junit.Ignore
+import org.junit.Test
+import kotlin.test.assertEquals
+
+/** U+00A0 is valid inside a tag, but the backend's TagMatcher ignores it in verbose regex mode. */
+class TagNonbreakingSpaceRegressionTest : InMemoryAnkiTest() {
+ @Test
+ @Ignore("Backend TagMatcher ignores U+00A0 and renames the wrong tag")
+ fun `renaming a tag containing a nonbreaking space leaves the tag without that space unchanged`() {
+ val source = addBasicNote().update { addTag("a\u00a0b") }
+ val unrelated = addBasicNote().update { addTag("ab") }
+
+ col.tags.rename("a\u00a0b", "renamed")
+
+ assertEquals(listOf("ab"), col.getNote(unrelated.id).tags, "Rename must not change the unrelated tag")
+ assertEquals(listOf("renamed"), col.getNote(source.id).tags)
+ assertEquals(listOf("ab", "renamed"), col.tags.all().sorted())
+ }
+
+ @Test
+ @Ignore("Backend TagMatcher ignores U+00A0 and deletes the wrong tag")
+ fun `deleting a tag containing a nonbreaking space leaves the tag without that space unchanged`() {
+ val source = addBasicNote().update { addTag("a\u00a0b") }
+ val unrelated = addBasicNote().update { addTag("ab") }
+
+ col.tags.remove("a\u00a0b")
+
+ assertEquals(listOf("ab"), col.getNote(unrelated.id).tags, "Delete must not change the unrelated tag")
+ assertEquals(emptyList(), col.getNote(source.id).tags)
+ assertEquals(listOf("ab"), col.tags.all())
+ }
+}
- Dominant language
- Kotlin
- Stars
- 12.3k
- Forks
- 3.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 383
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ankidroid/Anki-Android
-
Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ankidroid/Anki-Android#23392 ·
Maintainers usually reply within 1 day
-
Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ankidroid/Anki-Android#23390 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
ankidroid/Anki-Android#23385 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
ankidroid/Anki-Android#23374 ·
Maintainers usually reply within 1 day
-
Selected custom-study tags become unreadablePossibly taken @chesh-ire claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ankidroid/Anki-Android#23352 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in ankidroid/Anki-Android
Similar issues
-
Bug Domain changed
Difficulty 1/5 Under an hour Newbie friendliness 79/100
keiyoushi/extensions-source#21174 ·
Maintainers usually reply within 1 day
-
Unified account interface not translated into Simplified ChinesePossibly taken @xuenhua claimed this 3 days ago. Openunconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
thunderbird/thunderbird-android#11936 · 1 comment ·
Maintainers usually reply within 3 days
-
Update toast stylingOpendesign good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
scribe-org/Scribe-Android#778 ·
Maintainers usually reply within 1 day
-
AI Generated CI/CD ⚒️ Flaky-tests 🐦 go 🏃
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
valkey-io/valkey-glide#7772 ·
Maintainers usually reply within 1 day
-
Error Handling Swift
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/wordpress-rs#1759 ·
Maintainers usually reply within 1 day