Results after an empty search move the split editor to the first row
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
Start with the regression test shown in the issue, AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserEmptySearchPaneTest.kt, and trace how paneRow is updated when search results become empty and later repopulate. Run the focused Robolectric test and confirm that the edited note stays selected without showing a save prompt after the searches. The issue was discovered during PR review, so check that no work has already begun before picking it up.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Assisted-by: Claude Opus 5.5
[EXISTING] Results after an empty search move the split editor to the first row
Subject: [EXISTING] Results after an empty search move the split editor to the first row
After a search with no results, the next results open the first row instead of the edited note, asking to save unsaved edits.
⚠️ This issue existed before the PR and should likely be split off into a separate issue.
---
diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserEmptySearchPaneTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserEmptySearchPaneTest.kt
new file mode 100644
index 0000000000..be3b80bd95
--- /dev/null
+++ b/AnkiDroid/src/test/java/com/ichi2/anki/CardBrowserEmptySearchPaneTest.kt
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package com.ichi2.anki
+
+import androidx.appcompat.app.AlertDialog
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.ichi2.testutils.withSplitPaneUi
+import org.hamcrest.MatcherAssert.assertThat
+import org.hamcrest.Matchers.equalTo
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.robolectric.shadows.ShadowDialog
+
+@RunWith(AndroidJUnit4::class)
+class CardBrowserEmptySearchPaneTest : RobolectricTest() {
+ @Test
+ fun `results after an empty search keep the edited note in the pane`() =
+ withSplitPaneUi {
+ setCardBrowserFragmented(true)
+ val browser = getBrowserWithNotes(2)
+ browser.viewModel.setQuery("deck:Default", forceRefresh = true)
+ browser.waitForSearchResults()
+ advanceRobolectricLooper()
+ browser.clickRowAtPosition(1)
+ advanceRobolectricLooperUntil { browser.viewModel.paneRow == browser.viewModel.cards[1] }
+ advanceRobolectricLooper()
+ val editedRow = requireNotNull(browser.viewModel.paneRow)
+ requireNotNull(browser.fragment).editFieldAt(1)!!.setText("edited")
+
+ browser.viewModel.setQuery("nid:1", forceRefresh = true)
+ browser.waitForSearchResults()
+ advanceRobolectricLooper()
+ browser.viewModel.setQuery("deck:Default", forceRefresh = true)
+ browser.waitForSearchResults()
+ advanceRobolectricLooper()
+
+ assertThat("no save changes prompt", (ShadowDialog.getLatestDialog() as? AlertDialog)?.isShowing == true, equalTo(false))
+ assertThat("the edited note stays highlighted", browser.viewModel.paneRow, equalTo(editedRow))
+ }
+}
Found while handling https://github.com/ankidroid/Anki-Android/pull/22885#pullrequestreview-6064211858
- Lingua principale
- Kotlin
- Stelle
- 12.3k
- Fork
- 3.1k
- Merge medio
- 2g 1h
- PR unite (30g)
- 311
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ankidroid/Anki-Android
-
code-scan
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
ankidroid/Anki-Android#23806 ·
I maintainer di solito rispondono entro 1 giorno
-
code-scan
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
ankidroid/Anki-Android#23798 ·
I maintainer di solito rispondono entro 1 giorno
-
Send troubleshooting report does nothing with Never but says it was sentForse già presa @rishithareddychalla l’ha presa oggi. Apertacode-scan
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
ankidroid/Anki-Android#23797 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Browse rows that fail to load show as empty linesForse già presa @rishithareddychalla l’ha presa oggi. Apertacode-scan
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ankidroid/Anki-Android#23786 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
The note editor's Cards button shows card type names as HTMLForse già presa @rishithareddychalla l’ha presa oggi. Apertacode-scan
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ankidroid/Anki-Android#23756 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ankidroid/Anki-Android
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Remove Collect againAperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
thisisartman/Meguri#211 ·
I maintainer di solito rispondono entro 1 giorno
-
follow-up
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Bug: Paused screen is never cleared, so spans and logs keep the previous fragment's screen nameAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
open-telemetry/opentelemetry-android#2309 ·
I maintainer di solito rispondono entro 1 giorno
-
📦 expo-location Android contributor: external needs review sdk-58 severity: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
expo/expo#54405 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno