Page 1 of 1

Custom text and rich text editing?

Posted: Tue Feb 16, 2010 7:36 pm
by hyphz
Hi,

Is there any support in Rev, or an add-on, that will allow creating an editor with custom syntax highlighting? Or writing a program that will respond to changes in a large text file (rather than a simple text entry field)? I'm thinking about something along the lines of TodoPaper.

Thanks!

Re: Custom text and rich text editing?

Posted: Wed Feb 17, 2010 12:14 pm
by Mark
hyphz,

You'll have to parse the htmlText. For example, you could replace words with the same words surrounded by font tags:

Code: Select all

replace " red " with " <font color=red>red</font> " in myData
You will need to figure out how to do this in a smart way. For example, it isn't always necessary to parse the complete text.

Another possibility might be to use a repear loop:

Code: Select all

lock screen
repeat with x = 1 to number of words of fld y
  put colorArray[word x of fld y] into myColor
  if myColor is not empty then set the textColor of word x of fld y to myColor
end repeat
unlock screen
You could apply such a repeat loop to the line that is currently being edited or even to the last word(s) entered only.

Best,

Mark