commit 1ab7d26394ed315fe94fb9a12692d963ca221a8d
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Mon Aug 31 13:09:00 2026 +0200

    Prohibit completely entering in InsetInfo inset
    
    Avoids a crash related to search and replace.
    
    Original patch by Claude.
    
    Fixes bug #12808.
---
 src/insets/InsetInfo.h   | 8 +++-----
 src/insets/InsetText.cpp | 6 ++++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/insets/InsetInfo.h b/src/insets/InsetInfo.h
index 4066b54e88..fdaef96bb8 100644
--- a/src/insets/InsetInfo.h
+++ b/src/insets/InsetInfo.h
@@ -168,11 +168,9 @@ public:
        docstring layoutName() const override;
        ///
        Inset * editXY(Cursor & cur, int x, int y) override;
-       /** FIXME: we would like to do that, but then InsetText::updateBuffer 
breaks
-        * on info insets. Do we need to run this method on InsetInfo contents?
-        * Having a InsetInfo that hides an InsetText is really annoying, 
actually.
-        */
-       ///bool isActive() const override { return false; }
+       /// The contents are generated by build() and may be replaced under
+       /// the cursor's feet at any time, so never let the cursor in (#12808).
+       bool isActive() const override { return false; }
        ///
        bool editable() const override { return false; }
        ///
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index c66a54a287..fd46bebbc3 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -1142,9 +1142,11 @@ void InsetText::checkIntitleContext(ParIterator const & 
it)
 
 void InsetText::updateBuffer(ParIterator const & it, UpdateType utype, bool 
const deleted)
 {
+       LATTEST(it.nextInset() == this);
+       // Descend into this inset explicitly, because forwardPos() does
+       // not enter insets that are not active (e.g. InsetInfo).
        ParIterator it2 = it;
-       it2.forwardPos();
-       LASSERT(&it2.inset() == this && it2.pit() == 0, return);
+       it2.push_back(CursorSlice(*this));
        if (producesOutput()) {
                InsetLayout const & il = getLayout();
                bool const save_layouts = utype == OutputUpdate && 
il.htmlisblock();
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to