Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | pederbacher |
I want to color single characters in a TextEdit. Currently, it supports coloring a keyword with “add_keyword_color()”, but a keyword requires a symbol (or space) before and after to be identified, e.g. so one cannot just color all “a” easily.
I simply cannot figure out how to color a single character (or a sequence no surrounded by symbols), can anyone give some idea on how to do that?
Can I write a new function for the TextEdit which does that, maybe coloring (or setting some other font property) with regular expressions etc.
Actually, I did make a hack, by modding a font to include a zero width space and then inserting that all the time the text is changed.
Thanks in advance!