Anki/rslib/src
Damien Elmes 6b0fe4b381 undoable ops now return changes directly; add new *_ops.py files
- Introduced a new transact() method that wraps the return value
in a separate struct that describes the changes that were made.
- Changes are now gathered from the undo log, so we don't need to
guess at what was changed - eg if update_note() is called with identical
note contents, no changes are returned. Card changes will only be set
if cards were actually generated by the update_note() call, and tag
will only be set if a new tag was added.
- mw.perform_op() has been updated to expect the op to return the changes,
or a structure with the changes in it, and it will use them to fire the
change hook, instead of fetching the changes from undo_status(), so there
is no risk of race conditions.
- the various calls to mw.perform_op() have been split into separate
files like card_ops.py. Aside from making the code cleaner, this works
around a rather annoying issue with mypy. Because we run it with
no_strict_optional, mypy is happy to accept an operation that returns None,
despite the type signature saying it requires changes to be returned.
Turning no_strict_optional on for the whole codebase is not practical
at the moment, but we can enable it for individual files.

Still todo:
- The cursor keeps moving back to the start of a field when typing -
we need to ignore the refresh hook when we are the initiator.
- The busy cursor icon should probably be delayed a few hundreds ms.
- Still need to think about a nicer way of handling saveNow()
- op_made_changes(), op_affects_study_queue() might be better embedded
as properties in the object instead
2021-03-19 19:45:21 +10:00
..
backend undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
card undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
config undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
deckconf handle duplicate keys in schema 11 deckconf 2021-03-04 11:52:15 +10:00
decks undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
media undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
notes undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
notetype undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
revlog dispatch undo operations via enum instead of trait 2021-03-10 11:53:27 +10:00
scheduler undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
search use native boolkey instead of separate getters/setters 2021-03-10 11:53:27 +10:00
stats undo support for config entries 2021-03-10 11:53:27 +10:00
storage move collection mtime bump into backend 2021-03-19 19:45:21 +10:00
sync undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
tags undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
undo undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
adding.rs Simplify note adding and the deck/notetype choosers 2021-03-10 11:53:27 +10:00
backend_proto.rs NF: add AGPL licence missing in some file 2021-01-31 21:50:21 +01:00
cloze.rs handle multiple clozes in cloze-only filter 2020-07-29 12:54:29 +10:00
collection.rs undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
dbcheck.rs undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
err.rs Fix markdown escaping in search errors 2021-03-12 20:32:38 +01:00
filtered.rs undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
findreplace.rs undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
fluent_proto.rs NF: add AGPL licence missing in some file 2021-01-31 21:50:21 +01:00
i18n.rs plural rules and decimal separator should use bundle's language 2020-12-14 14:23:49 +10:00
latex.rs Add Alt text to latex image 2020-12-30 18:00:06 +01:00
lib.rs move ops.rs out of undo/ 2021-03-19 19:45:21 +10:00
log.rs skip terminal logging unless LOGTERM defined 2020-04-07 10:25:47 +10:00
markdown.rs render deck description with markdown; strip images 2021-02-06 15:02:40 +10:00
ops.rs undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
preferences.rs undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
prelude.rs undoable ops now return changes directly; add new *_ops.py files 2021-03-19 19:45:21 +10:00
serde.rs handle missing deck ID in templates 2021-01-25 16:47:23 +10:00
template.rs show the empty card message on the back of the card as well 2021-03-01 15:32:31 +10:00
template_filters.rs add cloze-only filter 2020-07-21 12:59:28 +10:00
text.rs initial work on moving v2 card answering into backend 2021-02-20 14:48:07 +10:00
timestamp.rs fix inconsistent test handling on Windows 2021-03-01 13:36:36 +10:00
types.rs add note/card removal to backend 2020-06-04 18:21:04 +10:00
version.rs don't pass BUILDINFO into build script 2020-12-21 16:04:29 +10:00