0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-19 19:42:17 +02:00

Fix can't delete search input in CardBrowser after an initial search

The DEL KeyEvent was previously declared to act as a keyboard shortcut
to delete the selected notes. After an initial search which registered
a search query entering DEL attempted to delete the current selected
notes which also resulted in another search(same input) being executed.

The fix registers the DEL keys as a delete notes shortcut ONLY if the
search box of the CardBrowser is not currently available(isIconified
returning true).
This commit is contained in:
lukstbit 2024-08-30 09:31:32 +03:00 committed by Brayan Oliveira
parent 83def3fad3
commit e7eee16a39

View File

@ -689,10 +689,17 @@ open class CardBrowser :
}
}
KeyEvent.KEYCODE_FORWARD_DEL, KeyEvent.KEYCODE_DEL -> {
if (searchView?.isIconified == false) {
Timber.i("Delete pressed - Search active, deleting character")
// the search box is available and could potentially receive input so handle the
// DEL as a simple text deletion and not as a keyboard shortcut
return false
} else {
Timber.i("Delete pressed - Delete Selected Note")
deleteSelectedNotes()
return true
}
}
KeyEvent.KEYCODE_F -> {
if (event.isCtrlPressed) {
Timber.i("Ctrl+F - Find notes")