void updatePosition (CodeEditorComponent& owner)
    {
        startTimer (400);
        setVisible (true);

        const Rectangle pos (owner.getCharacterBounds (owner.getCaretPos()));
        setBounds (pos.getX(), pos.getY(), 2, pos.getHeight());
    }
CodeEditorComponent::State::State (const CodeEditorComponent& editor)
    : lastTopLine (editor.getFirstLineOnScreen()),
      lastCaretPos (editor.getCaretPos().getPosition()),
      lastSelectionEnd (lastCaretPos)
{
    const Range<int> selection (editor.getHighlightedRegion());

    if (lastCaretPos == selection.getStart())
        lastSelectionEnd = selection.getEnd();
    else
        lastSelectionEnd = selection.getStart();
}