commit 8d4aaaebdae7fe8e6f4d81b5d6f57ce2e13f410d
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Wed Jul 2 11:50:27 2025 +0200

    Make sure to redraw paragraph when entering Preview inset (2/2)
    
    This commit forces a full redraw when clicking on a previewed
    InsetPreview or InsetIPA.
    
    Fixes bug #13193.
---
 src/insets/InsetIPA.cpp     |  5 +++++
 src/insets/InsetPreview.cpp | 11 +++++++++++
 src/insets/InsetPreview.h   |  3 +++
 3 files changed, 19 insertions(+)

diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp
index 604ad322a2..355878457b 100644
--- a/src/insets/InsetIPA.cpp
+++ b/src/insets/InsetIPA.cpp
@@ -80,7 +80,12 @@ void InsetIPA::doDispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
        default:
+               bool const has_preview = previewState(&cur.bv());
                InsetText::doDispatch(cur, cmd);
+               if (has_preview != previewState(&cur.bv()))
+                       // FIXME : it should be possible to trigger a SinglePar 
update
+                       //   on the parent paragraph.
+                       cur.screenUpdateFlags(Update::Force);
                break;
        }
 
diff --git a/src/insets/InsetPreview.cpp b/src/insets/InsetPreview.cpp
index c503b18b34..42de1e4dac 100644
--- a/src/insets/InsetPreview.cpp
+++ b/src/insets/InsetPreview.cpp
@@ -177,6 +177,17 @@ void InsetPreview::draw(PainterInfo & pi, int x, int y) 
const
 }
 
 
+void InsetPreview::doDispatch(Cursor & cur, FuncRequest & cmd)
+{
+       bool const has_preview = previewState(&cur.bv());
+       InsetText::doDispatch(cur, cmd);
+       if (has_preview != previewState(&cur.bv()))
+               // FIXME : it should be possible to trigger a SinglePar update
+               //   on the parent paragraph.
+               cur.screenUpdateFlags(Update::Force);
+}
+
+
 void InsetPreview::edit(Cursor & cur, bool front, EntryDirection entry_from)
 {
        bool const has_preview = previewState(&cur.bv());
diff --git a/src/insets/InsetPreview.h b/src/insets/InsetPreview.h
index 8b6a79bee8..32f2335dc3 100644
--- a/src/insets/InsetPreview.h
+++ b/src/insets/InsetPreview.h
@@ -74,6 +74,9 @@ public:
        //@}
 
 protected:
+       ///
+       void doDispatch(Cursor & cur, FuncRequest & cmd) override;
+
        /// Retrieves the preview state. Returns true if preview
        /// is enabled and the preview image is available.
        bool previewState(BufferView * bv) const;
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to