//only colorize for shift modifiers and no other modifiers (your alt+n will work) Document.current.keyUpAction_({|doc, key, mod, chr| if(mod| 131334==131334, {Document.current.syntaxColorize; "colorized".postln})})
but actually syntax colorize in large documents takes quite some cpu. are you aware of that? i believe it can even screw up timing of things like the default clock (Pbind playing). so i'd recommend to _not syntax colorize on each keydown. if you really need it to be automatic, i'd suggest to track a less less frequent character. like this...
//only colorize for return and enterDocument.current.keyUpAction_({|doc, key, mod, chr| if(chr==13 or: {chr==3}, {Document.current.syntaxColorize; "colorized".postln})})
or some other 'rare' key like space or dot.another idea is to use SkipJack and have a task in the background that run colorize on document.current once in a while.
_f 6 maj 2009 kl. 14.06 skrev Juan Gabriel Alzate Romero:
Hi all, I have a problem with the Document.keyDownAction & keyUpAction...I'm on a german Keyboard. I wanted to do automatic Syntax colorizing with an easy line, and it works (the colorizing) but when I write something it behaves strangely. This is my biggest problem:// new document - normal behaviouralt + n => ~ (highlighted and waits for the next key stroke to put the tilde on it)alt + n ... space => ~ alt + n ... n => ñ alt + n ... o => õ // new document Document.current.keyDownAction_({ Document.current.syntaxColorize }) // strange: doubles the tilde !! alt + n ... space => ~~ alt + n ... n => ~ñ alt + n ... o => ~õ // new document Document.current.keyUpAction_({ Document.current.syntaxColorize }) // won't be able to write õ, ñ... etcalt + n => ~ (instantly, doesn't highlight and waits for the next key stroke)I would like to know if there's another way to make syntax colorizing automatically without having this behaviour. I need both, the '~' and the 'ñ', so I would be very happy about solving this problem.Thanks in advance. -Juan.
#|
fredrikolofsson.com klippav.org musicalfieldsforever.com
|#
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/