Anki/qt/aqt
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
..
browser Track Current Deck Context from Browser (#3385) 2024-09-22 18:02:17 +10:00
data Fix ease button alignment (#3404) 2024-09-11 02:44:11 +07:00
forms Add revert to backup option to file menu (#3434) 2024-09-25 20:21:59 +10:00
import_export Fix imports of decks with file paths using special URL characters (#3377) 2024-08-29 17:19:27 +07:00
operations Update type annotations (#3322) 2024-07-26 17:57:25 +07:00
qt Improve exception handling (#3290) 2024-08-04 20:51:13 +07:00
__init__.py Fix Qt desktop file name warning (#3419) 2024-09-22 18:02:35 +10:00
_macos_helper.py Update type annotations (#3322) 2024-07-26 17:57:25 +07:00
about.py Add revert to backup option to file menu (#3434) 2024-09-25 20:21:59 +10:00
addcards.py Track Current Deck Context from Browser (#3385) 2024-09-22 18:02:17 +10:00
addons.py python: add missing type annotations for None values (#3364) 2024-08-22 16:03:44 +07:00
ankihub.py Integrate AnkiHub Sign-in (#3232) 2024-08-17 10:58:23 +07:00
changenotetype.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
clayout.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
colors.py Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
customstudy.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
dbcheck.py Ensure DB check tooltip appears in main window 2024-04-30 23:21:41 +10:00
debug_console.py fix: add proper imports (#3296) 2024-08-05 11:34:46 +07:00
deckbrowser.py Bump Python deps 2024-07-06 18:40:37 +07:00
deckchooser.py fix: add proper imports (#3296) 2024-08-05 11:34:46 +07:00
deckconf.py Improve exception handling (#3290) 2024-08-04 20:51:13 +07:00
deckdescription.py Update Python deps 2023-03-31 14:04:05 +10:00
deckoptions.py Fix formatting 2024-09-22 18:36:01 +10:00
editcurrent.py Fix field focus lost when pressing alt in the editor (#3378) 2024-08-29 17:32:24 +07:00
editor.py Revert "Fix pasting from the primary selection (#3413)" 2024-09-25 20:59:10 +10:00
emptycards.py Rework & unify webview identification and title setting (#2366) 2023-02-10 14:53:11 +10:00
errors.py fix: add proper imports (#3296) 2024-08-05 11:34:46 +07:00
exporting.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
fields.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
filtered_deck.py Use seconds instead of minutes for preview delay 2023-12-21 11:02:29 +10:00
flags.py Introduce new color palette using Sass maps (#2016) 2022-09-16 14:11:18 +10:00
gui_hooks.py Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
importing.py Updated error message to provide help for import if 'Legacy Import/Export' is enabled (#3399) 2024-09-11 02:06:35 +07:00
legacy.py Import submodules directly (#1662) 2022-02-13 13:40:47 +10:00
log.py Add support for python logging (#2969) 2024-02-11 16:41:50 +10:00
main.py Backup warning needs a new string 2024-09-27 19:36:58 +10:00
mediacheck.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
mediasrv.py Feat/FSRS Simulator (#3257) 2024-08-22 15:34:19 +07:00
mediasync.py Update type annotations (#3322) 2024-07-26 17:57:25 +07:00
modelchooser.py Update type annotations to use | operator (#3323) 2024-07-26 18:15:39 +07:00
models.py Add maximize hint for models.py (#3151) (#3328) 2024-08-05 15:21:18 +07:00
mpv.py Update type annotations to use | operator (#3323) 2024-07-26 18:15:39 +07:00
notetypechooser.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
overview.py Update type annotations (#3322) 2024-07-26 17:57:25 +07:00
package.py Improve exception handling (#3290) 2024-08-04 20:51:13 +07:00
preferences.py Integrate AnkiHub Sign-in (#3232) 2024-08-17 10:58:23 +07:00
profiles.py Ensure profile name is treated in a case-insensitive manner (#3372) 2024-08-22 17:35:48 +07:00
progress.py python: add missing type annotations for None values (#3364) 2024-08-22 16:03:44 +07:00
props.py Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00
py.typed mark anki and aqt modules as having typing info 2020-01-13 13:03:37 +10:00
reviewer.py typeanswer: [type:nc] – ignores combining characters (#3422) 2024-09-30 23:11:51 +10:00
schema_change_tracker.py Add ability to restore a notetype to its original configuration (#2472) 2023-04-18 14:07:51 +10:00
sound.py fix: add proper imports (#3296) 2024-08-05 11:34:46 +07:00
stats.py fix: add proper imports (#3296) 2024-08-05 11:34:46 +07:00
studydeck.py Update type annotations (#3322) 2024-07-26 17:57:25 +07:00
stylesheets.py Workaround Ubuntu ignoring tooltip palette in dark mode 2023-05-31 15:19:10 +10:00
switch.py python: add missing type annotations for None values (#3364) 2024-08-22 16:03:44 +07:00
sync.py Integrate AnkiHub Sign-in (#3232) 2024-08-17 10:58:23 +07:00
tagedit.py fix: add proper imports (#3296) 2024-08-05 11:34:46 +07:00
taglimit.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
taskman.py fix: add proper imports (#3296) 2024-08-05 11:34:46 +07:00
theme.py Update type annotations (#3322) 2024-07-26 17:57:25 +07:00
toolbar.py Update type annotation syntax (#3283) 2024-07-21 14:00:52 +07:00
tts.py Improve exception handling (#3290) 2024-08-04 20:51:13 +07:00
undo.py Dependency updates (#3040) 2024-02-28 16:28:04 +07:00
update.py Fix update suppression 2024-01-09 14:12:26 +10:00
utils.py Add an option to show image from editor in folder (#3412) 2024-09-20 21:38:44 +10:00
webview.py Hide right click copy option in deck list (#3363) 2024-08-17 13:18:46 +07:00
widgetgallery.py Improve debug console (#2435) 2023-03-15 15:29:05 +10:00
winpaths.py run pyupgrade over codebase [python upgrade required] 2021-10-04 15:05:48 +10:00