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.
This commit is contained in:
Jean-Marc Lasgouttes 2021-02-01 18:19:46 +01:00
parent 8d17594a33
commit 9f899a17fa
3 changed files with 12 additions and 7 deletions

View File

@ -1479,13 +1479,16 @@ DispatchResult const & GuiApplication::dispatch(FuncRequest const & cmd)
dr.screenUpdate(Update::FitCursor); 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); UndoGroupHelper ugh(buffer);
dispatch(cmd, dr); dispatch(cmd, dr);
// redraw the screen at the end (first of the two drawing steps). if (dr.screenUpdate() & Update::ForceAll) {
// This is done unless explicitly requested otherwise. for (Buffer const * b : theBufferList())
// This code is kept inside the undo group because updateBuffer b->changed(true);
// can create undo actions (see #11292) dr.screenUpdate(dr.screenUpdate() & ~Update::ForceAll);
}
updateCurrentView(cmd, dr); updateCurrentView(cmd, dr);
} }

View File

@ -4550,7 +4550,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
lyxrc.currentZoom, lyxrc.defaultZoom)); lyxrc.currentZoom, lyxrc.defaultZoom));
guiApp->fontLoader().update(); guiApp->fontLoader().update();
dr.screenUpdate(Update::Force | Update::FitCursor); dr.screenUpdate(Update::ForceAll | Update::FitCursor);
break; break;
} }

View File

@ -29,7 +29,9 @@ namespace Update {
SinglePar = 8, SinglePar = 8,
/// Only the inset decorations need to be redrawn, no text metrics /// Only the inset decorations need to be redrawn, no text metrics
/// update is needed. /// 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) inline flags operator|(flags const f, flags const g)