samyeyo / LuaRT

Open source Windows programming framework for Lua
https://www.luart.org
Other
285 stars 17 forks source link

Is there a way for syntax highlighting in an Edit? #82

Closed Dismalitie closed 1 year ago

Dismalitie commented 1 year ago

I noticed that the LuaRT Studio's code workspace has syntax highlighting and was wondering wether the same effect could be acheived in your UI module. If not, then maybe you could implement officially like this:

local text = ui.Edit(win, "magenta, blue, green", 10, 10)
for i="magenta" in text do
     i:highlight("magenta" or "#FF00FF")
end

or

local text = ui.Edit(win, "magenta, blue, green", 10, 10)
text:highlight("magenta", "#FF00FF")
samyeyo commented 1 year ago

Hi Dismalitie,

ui.Edit widget don't have highlighting support out of the box, as it is based on Windows Richedit component.

But you can use syntax highlighting manualy as in the following example : https://github.com/samyeyo/LuaRT/blob/master/examples/ui/syntax.wlua

Dismalitie commented 1 year ago

Thanks!