[LyX features/biginset] Text::dispatch: ignore single par update when there is a full update

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Jun 8 20:29:52 UTC 2024


commit cd3453ec453f811e4204eaad8d4df73fde7fa9c9
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Jun 7 16:49:25 2024 +0200

    Text::dispatch: ignore single par update when there is a full update
    
    Reorder the tests so that, when the flag Update::SinglePar has been
    specified, it does not take precedence over Update::Force flag.
    
    This fixes the crash with inset-split.
    
    (cherry picked from commit a1856427468cd4e442c77f394715c825d919f902)
---
 src/Text.cpp | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 4749f36d2c..642eb284c5 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -6374,27 +6374,17 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 		}
 	}
 
-	// FIXME: The cursor flag is reset two lines below
-	// so we need to check here if some of the LFUN did touch that.
-	// for now only Text::erase() and Text::backspace() do that.
-	// The plan is to verify all the LFUNs and then to remove this
-	// singleParUpdate boolean altogether.
-	if (cur.result().screenUpdate() & Update::Force) {
-		singleParUpdate = false;
-		needsUpdate = true;
-	}
-
 	// FIXME: the following code should go in favor of fine grained
 	// update flag treatment.
-	if (singleParUpdate || cur.result().screenUpdate() & Update::SinglePar) {
+	if (needsUpdate || cur.result().screenUpdate() & Update::Force)
+		cur.screenUpdateFlags(Update::Force | Update::FitCursor);
+	else if (singleParUpdate || cur.result().screenUpdate() & Update::SinglePar) {
 		// Inserting characters does not change par height in general. So, try
 		// to update _only_ this paragraph. BufferView will detect if a full
 		// metrics update is needed anyway.
 		cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
 		return;
 	}
-	if (needsUpdate)
-		cur.screenUpdateFlags(Update::Force | Update::FitCursor);
 	else {
 		// oldSelection is a backup of cur.selection() at the beginning of the function.
 	    if (!oldSelection && !cur.selection())


More information about the lyx-cvs mailing list