CodeEditor feature request

Could we add some simple LookAndFeel method to this component. I'm writing a simple debugger for Lua and i need to mark breakpoints and currently active lines of code, there is really no way to do that without modyfining the tokenizer code.

It looks like the GutterComponent could have a simple LookAndFeel method since it's paint() call seems straight forward, we could at least mark those lines there (with a custom font or color).

 

I had to manually draw onto the gutter component of my editor. Not pretty but it works Ok. I was able to highlight currently active lines using the caretTo() method. I also threw in all sorts of hacks for column edit more, intelligent formatting, etc, but it would be nice to have all this made available out of the box. Here is the code in case it's of any use to you. 

https://github.com/cabbageaudio/cabbage/blob/master/Source/Editor/CodeEditor.h
https://github.com/cabbageaudio/cabbage/blob/master/Source/Editor/CodeEditor.cpp 

I really don't want to re-implement this component, there is too much stuff here i don't understand and don't have the time to understand. Some simple access to some basic areas via LookAndFeel or some member virtual functions would be sufficient, i just need some basic debugging feature nothing fancy like Xcode or VS.

Yeah, I've no objection to adding some L+F stuff, just not sure when I'll have time. Feel free to suggest something to get me started!

In paint() of GutterComponent (line 286 of CodeEditorComponent.cpp)

add drawGutterComponent(Graphics &, const CodeEditorComponent &) and maybe getGutterComponentFont(const CodeEditorComponent &)

and also maybe in

CodeEditorComponent::CodeEditorLine::draw

add

drawCodeEditorLine (Graphics &, CodeEditorComponent &, const Font &, const float rightClip, const float x, const int y, const int lineH, const float characterWidth)

And add those method to the new LookAndFeel scheme you are using. That would get us started when we would need to draw some more complex syntax highlighting, debugger stuff etc.

Well here is patch that adds a "mark" feature, you can mark lines in the gutter component (like a breakpoint in VS/Xcode) you can toggle a mark (double click on the gutter component to toggle), you can fetch an array of all marked lines, you can set the colour of the background/foregroung of the marked line.

Just another patch that adds a virtual callback so we know when marked lines change

Just had a quick look at this, but what you're implemented here isn't general-purpose enough for me to add it.. It's a valid request, but just adding a bool to say whether a line is "marked" isn't very flexible, and neither is hard-wiring a double-click to toggle that. I'd have thought that the obvious place to start with something like this would be to create a mechanism for adding custom components in the gutter, so that they could handle their own clicks, etc. These would need to be created/destroyed as needed, like ListBox custom components work.