Le 17/03/2019 à 01:28, Isaac Oscar Gariano a écrit :
Dear Lyx Developors,
Dear Isaac,
Thanks a lot for this contribution. I am not really up to date with the
autocorrect code, so bear with me. A few remarks/questions:
I have improved the match autocorrect for lyx to support autocorrect
sequences with more than 2 characters, for example if the following line
is in the autocorrect file:
-- > \rightarrow\rightarrow
Typing --> will then autocorect to →→
Previously the first and last columns of the autocorrect file were
restricted to having 2 elements.
Where do I find the first and last command of autocorrect in the code?
The idea of extending it is very nice IMO.
I havn't updated the autocorrect file as I'm not sure what autocorrects
you'd want to be standard (ideas of the top of my head include ==> to ⟹
and /== to ≢)
Did you take a look at the TeXmacs completions commented out in the
file? We can enable the ones that are now possible.
I also added a button in the preferences window (in Editing → Input
Completion) to reload the autocorrect file, in case you modify it whilst
LyX is running.
This is not something we do for other support files. I understand why
you found it useful, but we (I) try to limit new entries in preference
files. Would it be possible to reload the file automatically when it is
detected that it has changed?
I have attached my git patch if you want to incorporate this feature
into LyX.
Would it be possible to split the patch in parts, for example to move
the reload pref to a separate patch that we can evaluate separately?
I also wanted to get Ctrl+Z to undo the autocorrect (but not the
character that triggered it), for example
you would type -->
it would get replaced by →→
you press Ctrl+Z it replaces the arrows with '-->'
This is not easy to do now bececause we have code (undo grouping) to
merge all undo action in one big group so that they are undone at the
same time. To do that, if I understand correctly, I would have to
introduce a splitUndoGroup function. This should not be difficult.
Anyway, as for the reloading I propose to split this from your commit
for now. We'll come to it eventually.
I'm also considiring making a similar autocorrect feature in text mode,
so you don't have to enter math mode to wright symbols, it could also be
used for example to correct words like "naive" to "naïve". Let me know
if this sounds like something you'd like Lyx to have.
Some people will thank you for that, other will hate you for it ;) I
think it would be a good feature, as long as it is disabled by default.
Hope this helps,
JMarc