Skip to content

Commit

Permalink
fix(CardBrowser): mark all if mixed selection
Browse files Browse the repository at this point in the history
If there is a mix of marked and unmarked notes selected,
'toggle mark' should mark all the notes

If all notes are marked, remove the mark
If no notes are marked, add the mark

This restores previous behaviour

Changed in 7a65160
non-squashed: [4846711]

Fixes 14821
  • Loading branch information
david-allison authored and mikehardy committed Nov 28, 2023
1 parent 25eda07 commit 0d8d2ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,11 @@ open class CardBrowser :
val cardIds = selectedCardIds
withProgress {
undoableOp {
val wantMark = !getCard(selectedCardIds.first()).note().hasTag("marked")
val noteIds = notesOfCards(cardIds)
// if all notes are marked, remove the mark
// if no notes are marked, add the mark
// if there is a mix, enable the mark on all
val wantMark = !noteIds.all { getNote(it).hasTag("marked") }
if (wantMark) {
tags.bulkAdd(noteIds, "marked")
} else {
Expand Down

0 comments on commit 0d8d2ca

Please sign in to comment.