Hey all -
I have written a prototype of a modernized code editor component for JUCE, and I’d like to ask for your opinions, or just gauge the level of interest.
To start with, here is a link to the code:
Example project here: https://github.com/jzrake/MclModules
I did this because I wanted a custom editor for needs of my own project. But I’m also kind of a “Sublime-o-phile” - its performance and editing features are just awesome and I was curious whether an editor built with JUCE could compete in terms of speed. Glyph rendering in Sublime is (I believe) done with a mix of Skia and some custom code. I should say that I’m on OSX, with the CoreGraphics backend, and I’m using JUCE to do the glyph placement, not the drawTextLayout
low level graphics method.
I did the rendering using a data structure that can quickly build a GlyphArrangement
from the visible subset of the document. There’s no viewport, I just scroll the text directly with a transform.
The underlying data structure will allow for multi-caret editing, syntax highlighting, code folding etc. Multi-caret is 90% there (it needs an algorithm to shift the downstream selections). I have not done anything toward syntax highlighting, but I know more-or-less how it’ll work (should be compatible with CodeTokeniser
). Word wrap and justification options are not yet implemented.
So anyway — I think I succeeded in making it fast. It’s also kind of elegant, to the extent that I shamefully lifted a couple of design elements from Sublime. Such things could of course be made more generic if folks are interested in adopting this into JUCE.
I did this over the course of 4 days (in addition to my day job) as proof of principle. So it’s not up to scale by any means. But, I’d really love to see a snappy, fully featured code-or-text editor evolving out there in the JUCE wilderness. Does anyone think this could be a step in that direction? Or, is everyone perfectly happy with the TextEditor
and CodeEditorComponent
options?
Best! -Zrake