Le 01/02/2021 à 14:03, Pavel Sanda a écrit :
Small updates, I get perfect reproducibility now:
- You dont need to type anything in new window 2, just zoom-in couple times is 
enough
- The cursor in table in window 1 is necessary, just loading up the manual is 
not enough.
   I generally put the cursor in the middle of "phantom" string in of the first 
row.
- The crash happens in branch too.

I cannot reproduce, but I see that the window redraw is done without recomputing metrics.

Can you confirm that the following patch helps?

JMarc

>From 53bed3fc5177176b30c031b3f452ace688646353 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Mon, 1 Feb 2021 18:19:46 +0100
Subject: [PATCH] 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 90d25b2525..455dbedfe0 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 bdd7f1d2b9..3ff1858657 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 af71c0e78d..0efa541122 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)
-- 
2.27.0

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to