more robust: make double-sure that this is the correct output, not a different version from concurrent GUI_Thread.later;
authorwenzelm
Sat, 09 Nov 2024 16:39:33 +0100
changeset 81413 2d9b6e32632d
parent 81412 4794576828df
child 81414 ed4ff84e9b21
more robust: make double-sure that this is the correct output, not a different version from concurrent GUI_Thread.later;
src/Tools/jEdit/src/pretty_text_area.scala
--- a/src/Tools/jEdit/src/pretty_text_area.scala	Sat Nov 09 16:34:14 2024 +0100
+++ b/src/Tools/jEdit/src/pretty_text_area.scala	Sat Nov 09 16:39:33 2024 +0100
@@ -104,12 +104,18 @@
           Exn.Interrupt.expose()
 
           GUI_Thread.later {
-            current_rendering = rendering
-            JEdit_Lib.buffer_edit(getBuffer) {
-              rich_text_area.active_reset()
-              getBuffer.setFoldHandler(new Fold_Handling.Document_Fold_Handler(rendering))
-              JEdit_Lib.buffer_undo_in_progress(getBuffer, setText(rich_text.source))
-              setCaretPosition(0)
+            if (metric == JEdit_Lib.font_metric(getPainter) &&
+              output == current_output &&
+              snapshot == current_base_snapshot &&
+              results == current_base_results
+            ) {
+              current_rendering = rendering
+              JEdit_Lib.buffer_edit(getBuffer) {
+                rich_text_area.active_reset()
+                getBuffer.setFoldHandler(new Fold_Handling.Document_Fold_Handler(rendering))
+                JEdit_Lib.buffer_undo_in_progress(getBuffer, setText(rich_text.source))
+                setCaretPosition(0)
+              }
             }
           }
         })