Commit graph

1375 commits

Author SHA1 Message Date
Damien Elmes
83a88d0779 fix comment + copy/paste error 2021-07-17 09:02:14 +10:00
Aleksa Sarai
5d7847515c scheduler: use deck config's initial ease in set_due_date
Previously we would just use 250% ease for any new card that had no
pre-configured ease, but this will result in decks that have
non-standard ease values to have "set due date" cards in them that don't
match. In order to make this somewhat more efficient, we cache
deckid->ease lookups during this operation.

Ref: <https://forums.ankiweb.net/t/set-due-date-doesnt-obey-default-ease-factor/9184>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-07-16 12:33:15 +10:00
Damien Elmes
eb4e18a45f Merge pull request #1293 from RumovZ/find-and-replace
Find & Replace
2021-07-16 10:47:16 +10:00
Damien Elmes
1e2ebd1c29 move from Python's URI escaping to IRI escaping in Rust
Should make non-Latin text readable in the HTML editor, without the
breakages reverted in the previous change.
2021-07-16 10:38:00 +10:00
RumovZ
4b1218184d Rework Find & Replace dialog:
- Add option to affect whole collection
- Allow to open without selection
- Add parameter for presetting field
2021-07-13 16:33:45 +02:00
RumovZ
a68b07d9ee Fix find & replace for notes without 'field_name'
Distinguish between no 'field_name' passed and 'field_name' not on note.
2021-07-13 16:21:13 +02:00
Damien Elmes
1189e763df minor tidyup in protobuf build script 2021-07-12 16:15:38 +10:00
Damien Elmes
08ddd9cc90 drop the cloze-in-basic check for now
Unfortunately a popular note taking tool has been misusing cloze
markers in its deck exports. We may want to add this back in the
future, but we'll probably want to start by warning users, to give
people time to adjust.
2021-07-11 20:31:02 +10:00
Damien Elmes
0eab59e522 configs.proto plural workaround no longer necessary 2021-07-11 19:35:18 +10:00
Damien Elmes
2238cdaa43 rename Config in protobuf to avoid conflict with module name
+ use the enum directly, instead of wrapping it in an object

Python code retains the old "Config" name.
2021-07-11 19:27:08 +10:00
Damien Elmes
e3b53fc078 split out remaining tags, stats, media and rendering 2021-07-10 23:16:18 +10:00
Damien Elmes
673955de5b split out sync, search, scheduler & config 2021-07-10 21:33:12 +10:00
Damien Elmes
1fb86d499d split out decks, deckconfig, notes, notetypes 2021-07-10 20:44:22 +10:00
Damien Elmes
c43674762e split out cards and collection 2021-07-10 19:52:31 +10:00
Damien Elmes
5255409093 refactor protobuf handling for split/import
In order to split backend.proto into a more manageable size, the protobuf
handling needed to be updated. This took more time than I would have
liked, as each language handles protobuf differently:

- The Python Protobuf code ignores "package" directives, and relies
solely on how the files are laid out on disk. While it would have been
nice to keep the generated files in a private subpackage, Protobuf gets
confused if the files are located in a location that does not match
their original .proto layout, so the old approach of storing them in
_backend/ will not work. They now clutter up pylib/anki instead. I'm
rather annoyed by that, but alternatives seem to be having to add an extra
level to the Protobuf path, making the other languages suffer, or trying
to hack around the issue by munging sys.modules.
- Protobufjs fails to expose packages if they don't start with a capital
letter, despite the fact that lowercase packages are the norm in most
languages :-( This required a patch to fix.
- Rust was the easiest, as Prost is relatively straightforward compared
to Google's tools.

The Protobuf files are now stored in /proto/anki, with a separate package
for each file. I've split backend.proto into a few files as a test, but
the majority of that work is still to come.

The Python Protobuf building is a bit of a hack at the moment, hard-coding
"proto" as the top level folder, but it seems to get the job done for now.

Also changed the workspace name, as there seems to be a number of Bazel
repos moving away from the more awkward reverse DNS naming style.
2021-07-10 19:17:05 +10:00
Damien Elmes
14263c7a79 move protobuf into separate folder in preparation for multiple files 2021-07-09 21:02:40 +10:00
RumovZ
e763745e05 Add pylib/browser.py for literal config keys
Also, remove config bools for sort order.
2021-07-05 12:44:48 +02:00
Henrik Giesel
5031bafb61 Add NOTETYPE_FIELD sidebar items 2021-06-30 21:02:23 +02:00
Damien Elmes
8870a9c4d5 zero out graves before comparison, instead of at creation
Will allow us to turn the check back on in the future without a client
update
2021-06-30 10:08:52 +10:00
Damien Elmes
c0a1c04c3c ignore graves in sanity check 2021-06-30 09:31:02 +10:00
Damien Elmes
33a9afaa1b add back in missing check for upload size
Compression now happens up-front, so we can tell in advance if the
upload size has been exceeded.
2021-06-29 10:50:03 +10:00
Damien Elmes
5b14a2968a catch invalid card ordinals in DB check
https://forums.ankiweb.net/t/error-corrupted-note/10976
2021-06-29 10:50:03 +10:00
Damien Elmes
d6e3964151 PEP8 cards.py 2021-06-27 12:12:23 +10:00
Damien Elmes
14a2cc44ac update to latest rusqlite 2021-06-25 16:22:21 +10:00
Damien Elmes
795afb7068 update most rust deps; skip rusqlite 2021-06-25 15:35:25 +10:00
Damien Elmes
78a7620079 update undo skipping; exclude deck/tag expand/collapse
Instead of calling a method inside the transaction body, routines
can now pass Op::SkipUndo if they wish the changes to be discarded
at the end of the transaction. The advantage of doing it this way is
that the list of changes can still be returned, allowing the sync
indicator to update immediately.

Closes #1252
2021-06-25 09:16:15 +10:00
Damien Elmes
249e009f27 cope with collections where latexsvg is not a bool 2021-06-24 15:29:21 +10:00
Damien Elmes
2f25a969e4 report object type where json decode fails 2021-06-24 15:28:24 +10:00
Damien Elmes
b959feb6e5 expose scheduler js option in deck config 2021-06-24 14:38:10 +10:00
Damien Elmes
4ffca62afe allow customization of default search text
https://forums.ankiweb.net/t/whats-the-default-search-when-browsing-now-also-how-do-i-choose-to-browse-current-deck/8922
2021-06-24 11:24:30 +10:00
Damien Elmes
ff095ed57b fix clippy lints for latest Rust 2021-06-21 13:09:36 +10:00
Damien Elmes
d89c538c48 in/out -> request/response
The saved characters weren't worth the increased difficulty when
reading, and the fact that we were deviating from protobuf norms.
2021-06-20 15:49:20 +10:00
Damien Elmes
63f183958a add rustls-native-certs
closes #1241
2021-06-18 18:15:41 +10:00
Damien Elmes
532ac8b511 Merge pull request #1230 from RumovZ/fields-check
Check for misplaced or missing clozes when adding and in the editor
2021-06-17 21:26:16 +10:00
RumovZ
3004b460db Assign dupe error the lowest precedence 2021-06-16 11:42:40 +02:00
Henrik Giesel
76e885c65e Add escape_anki_wildcards_for_search_node 2021-06-16 09:25:27 +02:00
Henrik Giesel
3585bf0157 Revert "Remove special treatment of tag:none"
This reverts commit 95285ef66d.
2021-06-16 17:19:21 +10:00
Henrik Giesel
a6b313db5b Remove special treatment of tag:none 2021-06-16 17:19:21 +10:00
Henrik Giesel
8fd024c020 Make Browser root nodes use "_*" uniformly 2021-06-16 17:19:21 +10:00
Damien Elmes
596e37cabc update Rust deps 2021-06-16 16:10:57 +10:00
RumovZ
8160e05bd6 Fix missing hyphen escape when normalizing search (#1233)
* Fix missing hyphen escape when normalizing search

* Add some more tests for normalization

* Use char to satisfy clippy
2021-06-15 10:02:39 +10:00
Damien Elmes
6643780f17 handle <br/> when rendering a single line
+ case-insensitive matching

https://forums.ankiweb.net/t/html-editor-modifies-note-when-a-field-with-break-tags-is-opened/10772
2021-06-14 13:05:48 +10:00
RumovZ
4fb2299386 Add check for out-of-place/missing clozes 2021-06-12 10:02:21 +02:00
Damien Elmes
153e1e8d41 new change notetype implementation for the frontend
- changes can now be undone
- the same field can now be mapped to multiple target fields, allowing
fields to be cloned
- the old Qt dialog has been removed
- the old col.models.change() API calls the new code, to avoid
breaking existing consumers. It requires the field map to always
be passed in, but that appears to have been the common case.
- closes #1175
2021-06-10 22:19:24 +10:00
Damien Elmes
3b4bb5fafd fix spurious text in header injected by rust analyzer 2021-06-10 09:06:37 +10:00
Damien Elmes
7f984851b4 add notetype changing to backend 2021-06-09 20:56:52 +10:00
Damien Elmes
95151f5025 add LIFO sorting options for new cards 2021-06-08 14:01:46 +10:00
Damien Elmes
aaba9a777a fix note changes triggering a queue rebuild 2021-06-08 12:09:35 +10:00
Damien Elmes
c7381676a1 Merge pull request #1217 from RumovZ/flag-ftl
Mark search-invalid-flag as a new string
2021-06-03 10:50:11 +10:00
RumovZ
6e570a8ffc search-invalid-flag -> search-invalid-flag-2 2021-06-02 21:49:33 +02:00