anki-mc
anki-mc copied to clipboard
Shortcut failing.
Hi,
The shortcut (Alt + the number keys
) fails during review, and sometimes I need to close and open anki to get it working again.
This has happened in previous versions, but not as often.
Info: Anki version 2.1.49 Windows 10
Could it be that you press alt on its own? Another press (without any number in between) alleviates the alt-lock in my case. Apart from this it never failed as far as I can tell.
Can you run the console version of anki and check for errors when it happens?
Could it be that you press alt on its own? Another press (without any number in between) alleviates the alt-lock in my case. Apart from this it never failed as far as I can tell.
The error doesn't seem to be that. I noticed that whenever we redo a card by the shortcut CTRL+Z
the error happens, and shortcut Alt + the number keys
stops responding. If I go back to the decklist, then to the review (shortcuts: DSS), the shortcut works again.
Can you run the console version of anki and check for errors when it happens?
How can I do this?
Yeah, I could reproduce it (it happens on Linux as well).
When returning with ^Z there seems to be another listener from the new card that lingers and overwrites the changes done with the shortcuts (here the third option is pressed but it is overwritten immediately afterwards):
JS info :143 0 0 1
JS info :143 0 0 0
You'll get the debug output when using the console version of anki.
I currently don't have much time on my hands unfortunately. But it shouldn't be too hard to figure out why this https://github.com/zjosua/anki-mc/blob/3ae80883e25872ad6201ed6718deae729adc1308/card/back.html#L110-L111 isn't working in the case of returning to a review with ^Z.
Was also able to reproduce this on Linux.
Using AnkiWebView Inspector, I confirmed that the event listener indeed was registered multiple times after ^Z
ing.
However adding document.removeEventListener('keydown', tickCheckboxOnNumberKeyDown, false);
on the front template before adding the event listener didn't fix the issue.
@zjosua I suppose we could add another listener that removes the old listener as soon as the page unloads (https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event). Or we transform this into JavaScript: https://gist.github.com/screamingworld/4d8ee991be564564e9725d919dd83841#file-jsts-event-listener-solution-ts