Le 20/06/2017 à 23:31, Guillaume MM a écrit :
Hi Jean-Marc,

There is the case of InsetMathRef which has nargs()!=0 but whose cell is not active. See e.g. the fix at 7337c968. Is the logic still valid in this case? Just in case.

Hi Guillaume,

What do you think of this one instead? I don't want to commit it and fix it up a third time :)

JMarc



>From 3d2fc98046c086fe89b2e431166de60cb3561148 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Fri, 23 Jun 2017 20:32:32 +0200
Subject: [PATCH] Fixup the fixup d0acc3e57044: use editable()/isActive()

While 522516d9 was too strong and broke mathed, d0acc3e57044 is too
lenient and can accept insets (mathed/CommandInset, InsetInfo) that
have a positive nargs() but are not editable (because they encapsulate
something).

Therefore the best solution for now is to use editable() in text and
isActive() in mathed, until those two things are merged.

Part of #10667.
---
 src/DocIterator.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp
index fe1250ff33..ac57b34a0e 100644
--- a/src/DocIterator.cpp
+++ b/src/DocIterator.cpp
@@ -562,7 +562,9 @@ bool DocIterator::fixIfBroken()
 	size_t n = slices_.size();
 	for (; i != n; ++i) {
 		CursorSlice & cs = slices_[i];
-		if (&cs.inset() != inset || cs.nargs() == 0) {
+		if (&cs.inset() != inset
+		    || (cs.inset().inMathed() ? ! cs.inset().isActive()
+		                              : ! cs.inset().editable())) {
 			// the whole slice is wrong, chop off this as well
 			--i;
 			LYXERR(Debug::DEBUG, "fixIfBroken(): inset changed");
-- 
2.11.0

Reply via email to