Allow definition of symbols which contain other symbols
For example if some symbol A is defined with key "a" and another symbol B is defined with key "ab", and "ab" is typed into the editor, Guppy recognizes the string as "Ab"
Yeah--this is the tradeoff for not requiring backslashes. There are some existing options that might help--see the discussion in #79. If you have another idea, I am open to considering what else should the editor do in this instance?
If you implemented a simple heuristic, you could potentially fix this in every case. Every time a key is pressed, we will make a "candidate list" of possible matches. If a candidate of a higher precedence is still on the list, we will not autoreplace. Auto-replacing only takes place if a there is no (potentially) longer candidate. For example, if you typed:
epsi (on your way to typing epsilon)
In your list, you will have
- epsilon
- psi
Since epsilon is incomplete, we won't match psi. You have two options to define the order:
- Make the symbols list ordered - If the symbols are ordered, you can not auto-replace if the candidate appears higher on the symbols list (the safest way)
- Simply order by "number of characters matched". Since epsi matches more characters in epsilon than it does for psi, you won't replace until the user presses another key that invalidates epsilon.
So if the user typed:
epsi+
guppy would replace that for
e Ψ +
as soon as the user typed the plus.