When I’m using the browser, I often get “update note” in my undo history even though I didn’t make any changes. I don’t even click on any fields, all I do is execute different searches, click on cards, view the card info and use the previewer. The “edited” cards/notes also appear in the search results for edited today (edited:1).
I also noticed that the “edited” note often corresponds to the first result of a search that I ran. It doesn’t happen on every search though, so might be tricky to reproduce.
I’m using 23.12.1 Qt6 on Windows. This also happens with add-ons disabled.
I find myself wondering – do you have “dynamic” elements on your card templates, or in the fields of some of your notes? Scripts, links, and other things that are activated when a card or field is drawn? These could even be things that came from add-ons, but exist separately from them and don’t rely on the add-on being active.
I do on some templates, but it also happens to cards that have a very simple template without any scripts, so I don’t think it’s related.
Anyway, I tested it a bit and noticed a few things:
I think it only happens when running a search, other actions don’t matter, but I’m not 100% sure. Like I said before, the first result of the search is affected.
It seems random which searches trigger the edit, at least I can’t see any pattern. For example, clicking on some days from a deck’s stats page triggers it, but clicking on others doesn’t.
It’s consistent - if I run a search that makes the edit, undo the edit and run the same search, it will happen again, every time.
Which searches trigger the edit also depends on current selected sort order in the browser.
Are you 100% sure that this happens even when all add-ons are all disabled – after starting Anki holding down Shift (until you see the confirmation message), so that none of them can have any effect?
It’s hard to know quite what to suggest when there’s no rhyme or reason to which notes are affected. For one of those simpler notes (even if you are in “Cards” mode in the Browse window, what is displayed and editable in the editor panel is the note) – are you able to get the whole thing in sight, open the HTML views, etc.? Can you see what the change is that Undo is undoing?
I suspect if you export to a text file before and after the change happens, there’ll be some minor difference. If the HTML was imported from an external source and is not in the format the editor writes out, it’ll end up getting updated when the note is opened in the editor.
You’re right! Here is an example from exported txt, before the change:
Chūbu 中部地方 ちゅうぶちほう "<img src=""Chubu.png"" />" [sound:pronunciation_ja_中部.mp3] region
After the change:
Chūbu 中部地方 ちゅうぶちほう "<img src=""Chubu.png"">" [sound:pronunciation_ja_中部.mp3] region
The closing slash from the img element gets deleted, but in Anki it’s not displayed even before the change/after undo, that’s why I couldn’t see any difference.
Why does it happen only on some specific searches? The Chūbu example above happened when the deck that contains it was selected and I just opened the browser, but it wouldn’t happen if I clicked on the deck in browser or search directly for Chūbu, even though the first result is the same. I also noticed it often happens when clicking on a specific day from the stats page.
Is there anything I can do about it? It’s not that big of a deal, but it does give me false edit logs if I miss and don’t undo the changes.
Do you need to undo the changes though? It looks like this is Anki correcting small formatting issues in the HTML. That seems like a good thing, doesn’t it?
Well, if I wanted to search in the future for notes that I actually modified, I would get those automatically corrected notes in the results as well, and cards work fine with the original formatting anyway. But it’s not that important and I already have many of those changes saved in my collection because I didn’t undo them most of the time.
Well, in this case you could use a find&replace to adjust all your image tags at once, and then they wouldn’t need to be changed as you edit. There is no way to do it automatically at the moment.