On Mar 28, 2005, at 10:21 AM, Jared Cohen wrote:

Not a bad idea, but real syntax highlighting doesn't work that way. If I'm programming C++ and I type the word "int", the word gets highlighted as a keyword the instant I type the "t", not when there's a pause in my typing. If that were the case, then I could type an entire paragraph and the highlighting wouldn't change until I was done.

Thanks anyway though. Any other ideas? :-)

How about a maintained list of keywords as part of your syntax dictionary that effect from the current insertion point forward (<!-- for example) and keywords that effect the entire document (--> for example)? This way you're not always parsing the entire text on an insertion. And, you might consider only updating the text that is visible at the moment of updating.

As another thought, how about auto-completion of the block for the user: i.e.: They type '<!--' and you automatically insert the closing '-->' on the next line or on a new line at the end of a selected section.

I can't think of anything else at the moment. Have you also considered examining what is done in VIM's syntax highlighting?

Tim
--
Tim Jones tjmac [at] tolisgroup [dot] com

Tim Jones wrote:
On Mar 28, 2005, at 10:10 AM, Jared Cohen wrote:

<snip>

�When that happens with every single keystroke, it adds up to a whole lot of highlighting. There's got to be a better way, but I can't think of one. Can anyone help?


How about using a timer to monitor the delay between keystrokes?� This way, you only update the highlight if the user pauses in their typing rather than after each keyup.

Tim
--
Tim Jones������������������������������������������������ tjmac [at] tolisgroup [dot] com


_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to