CodeEditorComponent caret not visible

Caret is invisible no matter of color setup.
Also in DemoRunner!
Am I missing something?

Hi there,

I just updated to juce 6.0.7 and I had the same problem. Previous version I was using was working fine with my same code. I believe there is a tiny bug which has been introduced to the recent version. In the constructor of the CodeEditorComponent the following lines

lookAndFeelChanged();
addAndMakeVisible (caret.get());

where,
void CodeEditorComponent::lookAndFeelChanged()
{
caret.reset (getLookAndFeel().createCaretComponent (this));
}

But if the lookAndFeelChanged() is called ( which was true to my case) the caret gets reset without being addAndMakeVisible to the component.

First time I write on the forum, not sure how quiclky the juce team will show my comments and validate if it is actually a bug to provide a fix but I had to move on so I moved the addAndMakeVisible (caret.get()); inside the lookAndFeelChanged .i.e

Constructor
lookAndFeelChanged();
//addAndMakeVisible (caret.get());

void CodeEditorComponent::lookAndFeelChanged()
{
if (caret.get() != nullptr)
removeChildComponent(caret.get());
caret.reset (getLookAndFeel().createCaretComponent (this));
addAndMakeVisible(caret.get());
}

My problem is solved. Maybe yours will be solved too. Good luck

I noticed this too after accidentally building one of my packages with v6 instead of 5…

This has been fixed on the develop branch:

2 Likes