Column edit CodeEditorComponent


#1

I'm thinking about adding some kind of column edit function to my code editor. I can override the mouseDown/Drag methods and inserting text on multiple lines shouldn't be too tricky, but I wonder about displaying a text caret on multiple lines? Is this possible? Or perhaps osmeone has already tried this?
 


#2

Hmm. Tricky to do that correctly. I've not looked at what would be involved, but I would suggest that going anywhere near the mouseDown methods would probably be a mistake.


#3

Thanks, I was just about to drink from a chalice full of mouseDown. No doubt hours of my time saved there. How about mouseDrag and mouseUp, ok to sip from those? I can live without the multiple carets on each line. I can just show flashing lights and sound sirens to indicate column mode is on :)


#4

I don't know really - at the moment it only has one caret, so I guess you'd need to extend that to use an array of them. Messy!


#5

Right now I'm trying to figure out how to make multiple, non-continuous highlighted regions. I was sure I managed this before, but maybe it was just another JUCE induced dream.


#6

As I expected it's relatively straight forward to insert/remove characters in column mode thanks to various methods offered via CodeDocument::Position. The only thing that remains a problem is how to let users know they are in column mode without some kind of visual feedback in the form of multiple carets. Hmm, could indeed get messy. There has to be a way of doing this without pulling the CodeEditorComponent to pieces? I'll keep digging.