[LyX/master] Revert "Do not display caret when we're not ready"
Scott Kostyshak
skostysh at lyx.org
Sat Mar 7 21:33:42 UTC 2020
commit 2ee5d3c3d5456062301305d20dd48345eb8673b3
Author: Scott Kostyshak <skostysh at lyx.org>
Date: Sat Mar 7 16:47:35 2020 -0500
Revert "Do not display caret when we're not ready"
This reverts commit e99436b529fc83a5a89e3ec053f977117c339082.
Kornel discovered a regression due to this commit. See:
https://www.mail-archive.com/search?l=mid&q=20200307121525.56be047b%40admin1-desktop
---
src/frontends/qt/GuiWorkArea.cpp | 36 ++++++++++++++++++-------------
src/frontends/qt/GuiWorkArea_Private.h | 6 ++--
2 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index 2500afe..ab13c68 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -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,26 +641,24 @@ void GuiWorkArea::Private::updateCaretGeometry()
}
-void GuiWorkArea::Private::showCaret(bool show)
+void GuiWorkArea::Private::showCaret()
{
- if (caret_visible_ == show)
+ if (caret_visible_)
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())
+ updateCaretGeometry();
+ p->viewport()->update();
+}
+
+
+void GuiWorkArea::Private::hideCaret()
+{
+ if (!caret_visible_)
return;
- if (caret_visible_)
- updateCaretGeometry();
- p->viewport()->update();
+ caret_visible_ = false;
+ //if (!qApp->focusWidget())
+ p->viewport()->update();
}
diff --git a/src/frontends/qt/GuiWorkArea_Private.h b/src/frontends/qt/GuiWorkArea_Private.h
index 75ad98d..6342eab 100644
--- a/src/frontends/qt/GuiWorkArea_Private.h
+++ b/src/frontends/qt/GuiWorkArea_Private.h
@@ -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();
More information about the lyx-cvs
mailing list