[LyX/master] Fix AutoInsert for style arguments with selection

Juergen Spitzmueller spitz at lyx.org
Sun Feb 15 13:32:40 UTC 2026


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

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

diff --git a/src/Text.cpp b/src/Text.cpp
index f8f976e8b6..c2db23aafe 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