]> git.lyx.org Git - features.git/commitdiff
Fix bug #6342: Pasting-bug in math-mode sub- and super-scripts
authorEnrico Forestieri <forenr@lyx.org>
Mon, 23 Nov 2009 00:59:18 +0000 (00:59 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 23 Nov 2009 00:59:18 +0000 (00:59 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32162 a592a061-630c-0410-9148-cb99ea01b6c8

src/Cursor.cpp

index 349725c579ef0cd184123e63e589c9a4c17502ca..1ddbfa40e0b9d6c1663ca76ff2ef8ba7c4d11830 100644 (file)
@@ -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