TextEditor caret thickness issues

Two things:

I would like a caret that is 1-pixel wide. Or the ability to set it. If this could be done through the look and feel that would be awesome, because my TextEditor is the one that the Label creates, so I don’t have direct access to it (although I suppose I could override Label::createEditorComponent()).

The second issue is that TextEditor::getCaretRectangle uses a different formula for calculating the caret rectangle than the actual drawing code:

    return Rectangle<int> (roundToInt (cursorX) - viewport->getX(),
                           roundToInt (cursorY) - viewport->getY(),
                           1, roundToInt (cursorHeight));


        g.fillRect (borderSize.getLeft() + textHolder->getX() + leftIndent + cursorX,
                    borderSize.getTop() + textHolder->getY() + topIndent + cursorY,
                    2.0f, cursorHeight);

I personally think TextEditor::paintOverChildren() should just do the equivalent of Graphics::fillRect (getCaretRectangle()) this way the calculation for the rectangle will always agree with what is drawn.

And I apologize in advance for nit picking, yes I realize we are talking about a one pixel difference! It’s just that my font size is small and it already looks bad enough unhinted (cough), that a 2-pixel caret is making the text hard to read when it’s in edit mode.

It’d be a real struggle to pretend to be interested in this one.

True, those two functions should be calculated the same way, and in fact the getCaretRect should return a floating-point box, not an integer one. Maybe at some point I’ll move the caret into the lookandfeel, but not right now.

well how about at least a TextEditor::setCaretThickness (float caretThickness); ? I can override the Label::createEditorComponent in that case.

No, the appearance of the caret doesn’t belong in the TextEditor class. I’m going to revamp it soon anyway, and the sensible thing to do will be to get the lookandfeel to return a Drawable that the editor should use for its caret. There’s no point in me adding new methods before that happens.

That sounds great!

Did this ever happen? What happened with Drawables?