[Bug] Creating copy of note and then discarding will destructively edit the original note

I can’t find anybody talking about this yet, but I’m probably searching the wrong thing. I thought for a while I was just being inattentive but anyway.

OS: Arch Linux
Anki Version: Version ⁨23.12.1 (1a1d4d54)⁩ [Python 3.9.15 Qt 6.6.1 PyQt 6.6.1]

Have disabled all add-ons, and bug remains.

The bug is that if I’m viewing a card and I press Ctrl+Alt+E to copy the note, then make an edit to one of the fields in the interface that pops up, and then, without actually having created at least one copy by clicking the 'Add" button, or using Ctrl+Enter, I click the close button, and then opt to discard my changes in the following popup, it actually applies the changes I made to the original card.

Please let me know what additional information might be helpful, and any other troublshooting steps I should take, if any.

The above reliably reproduces the bug.

Thanks.

EDIT: I should probably mention if it’s not already obvious for someone in the know looking at that Anki version string, that I am running Anki from the official binary, rather than from a package manager bundle, if that matters at all.

Not an answer, but in case it points someone else towards a possible solution –

This is not reproducible for me on Windows 11, same build. I tried it both from the Browse window and from the Study screen.

1 Like

I can’t reproduce it either. Maybe if you could record a video of how you’re triggering it, it will reveal what we’re doing differently.

1 Like

I was able to reproduce this using 23.12.1 on Windows 11.

I viewed a card as part of reviewing it (studying a deck). I followed the above instructions. The change I made was just adding the letter “z” to the end of one of the non-blank fields.

After discarding the changes, and the original card was showing again, I typed “e” to edit the note, and the change that should have been discarded was present in the original note.

After exiting Anki and restarting it, the “discarded” change is still there, in the original note.

1 Like

OK, I tried a variation. Typing “e” is what brings back and applies the “discarded” changes.


After following the described procedure, discarding the changes, and thus returning to viewing the original card, I typed “b” to see the Browse window.

In the two-part Browse window, in Cards mode, one part showed the line with the card in question highlighted, and the second part showed the fields of the note. The discarded change did not show up there.

Next I clicked on the original card window to return the focus to it, then typed “e” to edit it. Now the discarded change does shows up!

It not only shows up in the Edit Current window, but the field in the Browse window also updates as soon as the “e” is typed, to change the field to the supposedly-discarded changed version.

1 Like

Updated reproduction steps:

  1. Study a deck. When a card comes up for review, click on the More button and choose Create Copy… from the popup menu (actually for whatever reason, the Ctrl+Alt+E shortcut doesn’t work for me… it has no effect at all and does not bring up an Add window)

  2. In the Add window that popped up, change one of the fields by appending XXXXXXXXXXXX to it. Then click on the Close button. In the “Discard current input?” popup, click on Discard.

  3. We are back in the card review window. Click on Browse to open the Browse window, and make sure it is in Cards mode. The line corresponding to the current card should be highlighted in the Browse window listing: if it isn’t, then click on it. In the other part of the Browse window you should see the fields of the note that the current card belongs to. The note is unaltered: the discarded change has not been applied.

  4. Back in the card review window, click on the Edit button while watching the Browse window. As soon as the Edit Current window appears, the field in the Browse window changes to reflect the “discarded” changes. Those discarded changes also appear in the Edit Current window itself.

  5. If instead you don’t click on Edit and just go on to complete the review of the deck in the normal fashion, the original note never gets altered, and the discarded changes really do stay discarded.

3 Likes

Thanks sprvlcn. I was having a concurrent issue with display of cards not always updating correctly, so did not take notice when the card would initially not reflect the changes. Should have mentioned it anyway, poor form on my part. Thanks for your amazing troubleshoot.

Thanks for the detailed info; I’ve logged this on Copy note+discard results in original note being changed · Issue #3011 · ankitects/anki · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.