Hey Darlex, appreciate the support! The new version just released now has support for highlighting words as well as getting and setting the cursor position. Hope this helps out in your project.
pgimeno, this is a good idea and I went ahead and implemented passing the highlight option in this way. Thanks!pgimeno wrote: ↑Sun Jun 30, 2019 8:47 pmWouldn't it be better to have the words in a table where the keys are the words to highlight? That would avoid more objects, and the lookup would presumably be faster. Iterating would be slower, though, if it's necessary at all.coding.jackalope wrote: ↑Sun Jun 30, 2019 7:13 pm I've had plans to add text highlighting to the Input control. I like the idea of specifying the words to highlight like in your example so I'll have something like:where Highlight is a table that takes in a list of words and what color the word should be highlighted in.Code: Select all
Slab.Input("code_input", { Text = examplecode, MultiLine = true, H=500, W=500, Highlight = {{"function", {0, 0, 1, 1}}, {"end", {0, 0, 1, 1}}, {"local", {0, 0, 1, 1}}, ...}}
To put it explicitly, this is what I mean:Code: Select all
Highlight = {["function"] = {0, 0, 1, 1}, ["end"] = {0, 0, 1, 1}, ["local"] = {0, 0, 1, 1}, ...}