Local layout syntax highlight foundation

Lorenzo Bertini lorenzobertini97 at gmail.com
Fri Oct 7 17:22:30 UTC 2022


Hello list,

attached is a patch that adds a syntax highlighter to the local layout 
QTextEdit that supports some very basic LyX syntax. I remember someone 
asking for this, but nonetheless it can be useful.

I've encountered some problems and I would appreciate your help:

1. I can't find how to put files I've added to git inside a patch to 
send, so I have attached the two files, both go in src/frontend/qt. Sorry :)
2. LyXHighlighter differs a lot from LaTeXHighlighter: doesn't rely on 
regex as much. I was wondering if a merge could be possible, considering 
local layout can include Latex bits.
3. Generic regex based on position or keyword recognition. Which one?
4. Syntax keywords are hardcoded right now (I only added a few 
properties because it's tedious work and there's probably a better way). 
Is there a place where I can find all keywords LyX uses in a layout?

Thanks a lot in advance

Lorenzo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff_from_master.diff
Type: text/x-patch
Size: 1337 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20221007/f709ccfd/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LyXHighlighter.h
Type: text/x-chdr
Size: 1181 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20221007/f709ccfd/attachment-0001.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LyXHighlighter.cpp
Type: text/x-c++src
Size: 2503 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20221007/f709ccfd/attachment-0001.cpp>


More information about the lyx-devel mailing list