You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I type ‘<’, then, ‘-’, the first match is triggered replacing the characters with a left arrow ‘←’.
If I add ‘>’ afterwards, nothing happens, despite the presence of the trigger sequence of the second match.
It would be great if the second match could also work.
I think, this behavior could be switched by a global option (off by default to prevent breaking of existing configurations).
Also, max_recursion_depth parameter should be defined to prevent infinite recursions like this:
matches:
- trigger: "!"replace: "!!"
(Maybe, just max_recursion_depth = 0 by default, and no need for a separate on/off option.)
Ideally, a static analyzer could warn the user about an infinite recursion in the config.
Motivation
I think, the left-right arrow example above is a legitimate use case.
Also, in my keyboard layout, I have combining diacritical characters.
I use Espanso to replace letter+diacritic combination with a precombined character.
Now, I cannot get precombined characters with two or more diacritics,
matches:
- trigger: "a\u0302"# LATIN SMALL LETTER A, COMBINING CIRCUMFLEX ACCENTreplace: "â"# LATIN SMALL LETTER A WITH CIRCUMFLEX
- trigger: "â\u0301"# LATIN SMALL LETTER A WITH CIRCUMFLEX, COMBINING ACUTE ACCENTreplace: "ấ"# LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE
Alternatives
Alternatively, similar results could be achieved by allowing trigger backtracking — making Espanso remember previous keyboard input even after replacing and cancel previous replacements when a larger one matches:
Description
Now, triggers work with text typed on the keyboard, but don’t work with text already replaced by Espanso.
Consider the following match file:
When I type ‘<’, then, ‘-’, the first match is triggered replacing the characters with a left arrow ‘←’.
If I add ‘>’ afterwards, nothing happens, despite the presence of the trigger sequence of the second match.
It would be great if the second match could also work.
I think, this behavior could be switched by a global option (off by default to prevent breaking of existing configurations).
Also,
max_recursion_depth
parameter should be defined to prevent infinite recursions like this:(Maybe, just
max_recursion_depth
= 0 by default, and no need for a separate on/off option.)Ideally, a static analyzer could warn the user about an infinite recursion in the config.
Motivation
I think, the left-right arrow example above is a legitimate use case.
Also, in my keyboard layout, I have combining diacritical characters.
I use Espanso to replace letter+diacritic combination with a precombined character.
Now, I cannot get precombined characters with two or more diacritics,
Alternatives
Alternatively, similar results could be achieved by allowing trigger backtracking — making Espanso remember previous keyboard input even after replacing and cancel previous replacements when a larger one matches:
I think, however, that this approach is a bit more complicated.
Have you tried building it? Or would you like it?
The text was updated successfully, but these errors were encountered: