[LyX/master] Always update buffer when language is being changed (#12481)

Juergen Spitzmueller spitz at lyx.org
Tue Feb 15 14:45:19 UTC 2022


commit 9729b22d9e964f22b18c9f82add716b91873c006
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Tue Feb 15 16:17:19 2022 +0100

    Always update buffer when language is being changed (#12481)
---
 src/Text3.cpp |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/Text3.cpp b/src/Text3.cpp
index c75a9c3..777a580 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -118,6 +118,11 @@ static void toggleAndShow(Cursor & cur, Text * text,
 						       cur.real_current_font))
 			text->setCursor(cur, cur.pit(), cur.pos(),
 					false, !cur.boundary());
+		if (font.language() != ignore_language)
+			// We need a buffer update if we change the language
+			// (e.g., with info insets or if the selection contains
+			// a par label)
+			cur.forceBufferUpdate();
 	}
 }
 
@@ -2520,10 +2525,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 		selectWordWhenUnderCursor(cur, WHOLE_WORD_STRICT);
 		Font font(ignore_font, lang);
 		toggleAndShow(cur, this, font, toggle);
-		// We need a buffer update if we change the language
-		// of an info inset
-		if (cur.insetInSelection(INFO_CODE))
-			cur.forceBufferUpdate();
 		break;
 	}
 
@@ -2558,10 +2559,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 			freeFonts.push(make_pair(props, font));
 			toggleall = toggle;
 			toggleAndShow(cur, this, font, toggleall);
-			// We need a buffer update if we change the language
-			// of an info inset
-			if (cur.insetInSelection(INFO_CODE))
-				cur.forceBufferUpdate();
 			cur.message(bformat(_("Text properties applied: %1$s"), props));
 		} else
 			LYXERR0("Invalid argument of textstyle-update");


More information about the lyx-cvs mailing list