From 38a6848ecdca451348d1989fcccbdfbd91100941 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 23 Nov 2009 00:59:18 +0000 Subject: [PATCH] Fix bug #6342: Pasting-bug in math-mode sub- and super-scripts git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32162 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Cursor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 349725c579..1ddbfa40e0 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1303,7 +1303,7 @@ void Cursor::niceInsert(docstring const & t, Parse::flags f) { MathData ar(buffer()); asArray(t, ar, f); - if (ar.size() == 1) + if (ar.size() == 1 && selection()) niceInsert(ar[0]); else insert(ar); @@ -1314,9 +1314,10 @@ void Cursor::niceInsert(MathAtom const & t) { macroModeClose(); docstring const safe = cap::grabAndEraseSelection(*this); + // Enter the new inset and, if something is selected, + // move the contents of the selection if possible. plainInsert(t); - // enter the new inset and move the contents of the selection if possible - if (t->isActive()) { + if (!safe.empty() && t->isActive()) { posBackward(); // be careful here: don't use 'pushBackward(t)' as this we need to // push the clone, not the original -- 2.39.2