obsidian-latex-suite
obsidian-latex-suite copied to clipboard
[BUG] Automatic expansion doesn't work properly with diacritics
Description
Any automatic expansion snippet triggered by a character wil also trigger when a diacritic is input simultaneously with the character (for example ^
+2
instead of ^
+space
+2
). In addition, it will not replace that character.
Any automatic expansion snippet triggered by a diacritic followed by a character won't trigger when they're input at the same time.
To Reproduce
{trigger: "ab", replacement: "c", options: "A"}
will trigger with "^b", which it shouldn't, and will result in "cb" instead of "c".
{trigger: "(\\w|\\d)(\\w|\\d)", replacement: "c", options: "rA"}
will also trigger and result in "c[[1]]" instead of "c".
{trigger: "ba", replacement: "c", options: "A"}
works as intended and won't trigger when inputting "bâ"
{trigger: "^2", replacement: "c", options: "A"}
won't trigger when input sequence is ^
+2
, but triggers correctly with ^
+space
+2
.
{trigger: "\\^(\\w|\\d)", replacement: "c", options: "rA"}
also won't trigger.
Expected Behavior
Diacritics followed by characters that don't support diacritics should be treated as a sequential input (diacritic then character), and should not trigger snippets that don't include that diacritic. When a snippet involves a diacritic, it should trigger even if that diacritic is input simultaneously as other character.
Additional context
I use an ABNT-2 keyboard and it's usual for me to input powers like "^2" by pressing first the ^
key, then the number key, without placing the "^" directly in the text. This breaks the auto subscript snippet {trigger: "([A-Za-z])(\\d)", replacement: "[[0]]_{[[1]]}", options: "rmA", priority: -1},
resulting in "x_{2}2" even tough it shouldn't've been triggered. I've had to work around by making this snippet manual because it's annoying to have to write powers pressing space.