Revert "Do not display caret when we're not ready"

I did not mean to push this.

This reverts commit 9bc255dc89.
This commit is contained in:
Jean-Marc Lasgouttes 2020-03-13 16:23:01 +01:00
parent 65e0aa767d
commit 7d54d78691
2 changed files with 26 additions and 20 deletions

View File

@ -439,6 +439,14 @@ void GuiWorkArea::stopBlinkingCaret()
void GuiWorkArea::startBlinkingCaret()
{
// do not show the cursor if the view is busy
if (view().busy())
return;
// Don't start blinking if the cursor isn't on screen.
if (!d->buffer_view_->caretInView())
return;
d->showCaret();
// Avoid blinking when debugging PAINTING, since it creates too much noise
@ -633,29 +641,27 @@ void GuiWorkArea::Private::updateCaretGeometry()
}
void GuiWorkArea::Private::showCaret(bool show)
void GuiWorkArea::Private::showCaret()
{
if (caret_visible_ == show)
return;
caret_visible_ = show;
/**
* Do not trigger the painting machinery if either
* 1. the view is busy (no updates at all)
* 2. The we are not ready because document is being modified (see bug #11763)
* 3. The caret is outside of screen anyway.
*/
if (p->view().busy()
|| buffer_view_->buffer().undo().activeUndoGroup()
|| !buffer_view_->caretInView())
return;
if (caret_visible_)
updateCaretGeometry();
return;
updateCaretGeometry();
p->viewport()->update();
}
void GuiWorkArea::Private::hideCaret()
{
if (!caret_visible_)
return;
caret_visible_ = false;
//if (!qApp->focusWidget())
p->viewport()->update();
}
void GuiWorkArea::Private::updateScrollbar()
{
// Prevent setRange() and setSliderPosition from causing recursive calls via

View File

@ -87,10 +87,10 @@ struct GuiWorkArea::Private
void dispatch(FuncRequest const & cmd0);
/// recompute the shape and position of the caret
void updateCaretGeometry();
/// show the caret if it is not visible. Same as \c hideCaret when \c show is false.
void showCaret(bool show = true);
/// show the caret if it is not visible
void showCaret();
/// hide the caret if it is visible
void hideCaret() { showCaret(false); }
void hideCaret();
/// Set the range and value of the scrollbar and connect to its valueChanged
/// signal.
void updateScrollbar();