Anki/proto/anki
a.r e2124cd790
typeanswer: [type:nc] – ignores combining characters (#3422)
* typeanswer: fix cleanup

Fix: Add prepare_expected back in for the 'nothing typed' & 'correctly typed' cases. This also makes expected_original redundant again.

Style: %s/provided/typed/g

Style: rename one ch → c

Testcase: whitespace_is_trimmed: added a check for the "correctly typed" path and renamed it to tags_removed (there's no whitespace?)

Testcase: empty_input_shows_as_code: changed to also check that tags get trimmed

* [type:nc] – ignores combining characters

Adds a comparison variant to [type] which ignores when combining characters of the expected field are missing from the provided input. It still shows these characters in the 'expected' line for reference.

It's useful for languages with e.g. diacritics that are required for reference (such as in dictionaries), but rarely actually learned or used in everyday writing. Among these languages: Arabic, Hebrew, Persian, Urdu.

The bool 'combining' controls it as new final parameter of both relevant compare_answer functions. On the Python side, it's set to true by default.

Use on the note templates: [type:nc:field] (only the front needs to include :nc)

This also removes the need to have both variants of words/sentences present as separate fields, to show them redundantly, etc.

* typeanswer: simplify by using nfkd throughout

Requires adjusting two testcases, but both render exactly the same in Anki itself.

On NFC vs. NKFD: https://stackoverflow.com/a/77432079

* typeanswer: 'simplify' by removing normalize_typed (requiring a bool parameter)

I'd prefer to keep this extra method.

* typeanswer: micro-optimize vectors

Should get rid of most relocations, at the expense of over-allocating.

On Vec's (String's) behavior: https://stackoverflow.com/a/72787776

* Mark `combining` as private

typeCorrect is not marked as private either, but we can at least do
the right thing for newly-added code.

* Revert "typeanswer: micro-optimize vectors"

This reverts commit 9fbacbfd19.

* Revert "typeanswer: 'simplify' by removing normalize_typed (requiring a bool parameter)"

This reverts commit df2dd3394e.
2024-09-30 23:11:51 +10:00
..
ankidroid.proto More service generation refactoring 2023-06-22 09:46:09 +10:00
ankihub.proto Integrate AnkiHub Sign-in (#3232) 2024-08-17 10:58:23 +07:00
ankiweb.proto Change Anki's version scheme; bump to 23.09 (#2640) 2023-09-07 12:37:15 +10:00
backend.proto Add support for custom certificates (#3203) 2024-05-24 10:57:54 +01:00
card_rendering.proto typeanswer: [type:nc] – ignores combining characters (#3422) 2024-09-30 23:11:51 +10:00
cards.proto Empty cards become undoable (#3386) 2024-08-29 20:06:41 +07:00
collection.proto Show total review count when optimizing FSRS parameters (#3027) 2024-02-26 13:27:22 +07:00
config.proto load balancer! (#3230) 2024-08-17 12:50:54 +07:00
deck_config.proto Feature Show Reminder before answer (#3064) (#3119) 2024-04-13 08:39:50 +01:00
decks.proto Use seconds instead of minutes for preview delay 2023-12-21 11:02:29 +10:00
frontend.proto Improve presentation of importing results (#2568) 2023-08-02 20:29:44 +10:00
generic.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
i18n.proto More service generation refactoring 2023-06-22 09:46:09 +10:00
image_occlusion.proto Maintain original IO cloze order in editing mode (#2987) 2024-02-07 13:42:47 +10:00
import_export.proto Allow im-/exporting with or without deck configs (#2804) 2023-11-13 13:54:41 +10:00
links.proto Rework error dialog 2023-11-29 10:25:32 +10:00
media.proto Add a backend method to extract static media references (#2716) 2023-10-11 14:10:02 +10:00
notes.proto Add a backend method to add notes in bulk (#2659) 2023-09-16 13:51:32 +10:00
notetypes.proto Add image occlusion to stock notetypes 2023-10-22 11:00:39 +10:00
scheduler.proto Feat/FSRS-5 (#3298) 2024-07-21 21:02:24 +07:00
search.proto Possible to show “last” subdeck name in Browser? (#3387) 2024-09-20 20:33:28 +10:00
stats.proto Feat/forgetting curve in card info (#3437) 2024-09-27 19:32:40 +10:00
sync.proto Add support for custom certificates (#3203) 2024-05-24 10:57:54 +01:00
tags.proto More service generation refactoring 2023-06-22 09:46:09 +10:00