[LyX/master] Force redraw of all bufferviews after zoom in/out
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Wed Feb 3 14:50:01 UTC 2021
commit 9f899a17fabb88e8e1b31da88ad6000605f26f7c
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Mon Feb 1 18:19:46 2021 +0100
Force redraw of all bufferviews after zoom in/out
Add a new ForceAll update flag that forces to update metrics and
redraw all buffer views.
The situation in multi windows setting is very fragile and will need
to be adressed properly in the 2.5 cycle.
---
src/frontends/qt/GuiApplication.cpp | 13 ++++++++-----
src/frontends/qt/GuiView.cpp | 2 +-
src/update_flags.h | 4 +++-
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 90d25b2..455dbed 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -1479,13 +1479,16 @@ DispatchResult const & GuiApplication::dispatch(FuncRequest const & cmd)
dr.screenUpdate(Update::FitCursor);
{
- // This handles undo groups automagically
+ // All the code is kept inside the undo group because
+ // updateBuffer can create undo actions (see #11292)
UndoGroupHelper ugh(buffer);
dispatch(cmd, dr);
- // redraw the screen at the end (first of the two drawing steps).
- // This is done unless explicitly requested otherwise.
- // This code is kept inside the undo group because updateBuffer
- // can create undo actions (see #11292)
+ if (dr.screenUpdate() & Update::ForceAll) {
+ for (Buffer const * b : theBufferList())
+ b->changed(true);
+ dr.screenUpdate(dr.screenUpdate() & ~Update::ForceAll);
+ }
+
updateCurrentView(cmd, dr);
}
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index bdd7f1d..3ff1858 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -4550,7 +4550,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
lyxrc.currentZoom, lyxrc.defaultZoom));
guiApp->fontLoader().update();
- dr.screenUpdate(Update::Force | Update::FitCursor);
+ dr.screenUpdate(Update::ForceAll | Update::FitCursor);
break;
}
diff --git a/src/update_flags.h b/src/update_flags.h
index af71c0e..0efa541 100644
--- a/src/update_flags.h
+++ b/src/update_flags.h
@@ -29,7 +29,9 @@ namespace Update {
SinglePar = 8,
/// Only the inset decorations need to be redrawn, no text metrics
/// update is needed.
- Decoration = 16
+ Decoration = 16,
+ /// Force metrics and redraw for all buffers.
+ ForceAll = 32
};
inline flags operator|(flags const f, flags const g)
More information about the lyx-cvs
mailing list