[LyX/2.5.x] Fix AutoInsert for style arguments with selection

Juergen Spitzmueller spitz at lyx.org
Wed Feb 25 05:32:49 UTC 2026


commit 76e726e2a443ce4245c7c640f4034a3adbba5c64
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Feb 15 14:31:33 2026 +0100

    Fix AutoInsert for style arguments with selection
    
    (cherry picked from commit bc0727f024adb78ddbc580528ee136111d428205)
---
 src/Text.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/Text.cpp b/src/Text.cpp
index b4bd60236f..1ba0c032e0 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -5052,6 +5052,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 		for (auto const & la_pair : tclass[layout].args()) {
 			Layout::latexarg const & arg = la_pair.second;
 			if (arg.autoinsert) {
+				// For the first autoarg, if there is
+				// a selection and InsertCotext is false,
+				// clear selection (#12364)
+				if (!inautoarg && !arg.insertcotext)
+					cur.clearSelection();
 				// If we had already inserted an arg automatically,
 				// leave this now in order to insert the next one.
 				if (inautoarg) {


More information about the lyx-cvs mailing list