TextEditor caret bug


if TextEditor::setCaretVisible() is called while the textEditor is NOT enable, then its caret will be destroyed.
The problem is that the caret is not re-created when we enable back the textEditor.

Such a thing can (for example) occurs during a lookAndFeel change when the textEditor is disabled.
So a quick way to reproduce :

        textEditor.setEnabled (false);
        textEditor.setLookAndFeel (&newLnf);   // will lead to a call to setCaretVisible()
        textEditor.setEnabled (true);

after that the textEditor does not have anymore caret.


Thanks - try it again now.

I'm affraid it still does not work Jules.

Ok, thanks - I'll look at it again..

the caret still won't be created again. you can reproduce with just that now :

        textEditor1.setEnabled (false);
        textEditor1.setEnabled (true);

I think that the problem is that recreateCaret() is calling isCaretVisible() which does not test a shouldCaretBeVisible flag or something, but just test (caret != nullptr)

Since you're already posting about text editor bugs, I should probably mention that DirectWrite isn't rendering properly with the CodeEditorComponent. It's kind of hard to explain what it's doing exactly. When you type, you can only see little marks at the top of the line, but if you go down in the editor then come back up and start typing, it renders correctly. Pretty strange. This is on Windows 10 with VS2015. I know there were some problems with it a while back.

small bump, just in case you missed my post

Didn't miss it, will take a look again. (I think actually I misunderstood what you were asking for originally)