Bmax 1.28 slow syntax highlight on mac

BlitzMax Forums/BlitzMax Programming/Bmax 1.28 slow syntax highlight on mac

remz(Posted 2007) [#1]
Hey Brucey

I reached the same conclusion as you: by adding this in cocoa.macos.m:

void NSLockText(nsgadget *gadget)
...
[[textarea storage] beginEditing];


and vice-versa in NSUnlockText -> endEditing, the performance of Bmax IDE syntax highlighting is ultra-fast. A fraction of a second to syntax highlight maxIDE.bmx.

They mention it clearly in the documentation:
http://developer.apple.com/documentation/Cocoa/Conceptual/TextEditing/Tasks/BatchEditing.html

If your code needs to modify the text backing store directly, you should bracket the changes between the NSTextStorage methods beginEditing and endEditing. Although this bracketing is not strictly necessary, it’s good practice, and it’s important for efficiency if you’re making multiple changes in succession.


However in your previous post you mentionned a problematic cursor position upon unlocking and a crash with Replace All. I don't seem to reproduce the Replace All bug, but the cursor does indeed jump at the end of the file on several cases.
i.e.: type rem then press space. Poof: the cursor disappear and jumps at the bottom. However if you press up arrow instead of space, the cursor moves correctly. Strange behavior.