]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
Attempt to fix #8137 (arrived at r40862).
[lyx.git] / src / CutAndPaste.cpp
index c8e99abcabb9cb3b894e033299f0e9b674c93d0a..4914afb7cd16e1da36586022fd17b8c06df90245 100644 (file)
@@ -256,13 +256,13 @@ pasteSelectionHelper(Cursor const & cur, ParagraphList const & parlist,
                                                if (ref->getParam("reference") == oldname)
                                                        ref->setParam("reference", newname);
                                        } else if (itt->lyxCode() == MATH_REF_CODE) {
-                                               InsetMathHull * mi = itt->asInsetMath()->asHullInset();
+                                               InsetMathRef * mi = itt->asInsetMath()->asRefInset();
                                                // this is necessary to prevent an uninitialized
                                                // buffer when the RefInset is in a MathBox.
                                                // FIXME audit setBuffer calls
                                                mi->setBuffer(const_cast<Buffer &>(buffer));
-                                               if (mi->asRefInset()->getTarget() == oldname)
-                                                       mi->asRefInset()->changeTarget(newname);
+                                               if (mi->getTarget() == oldname)
+                                                       mi->changeTarget(newname);
                                        }
                                }
                        }
@@ -286,14 +286,13 @@ pasteSelectionHelper(Cursor const & cur, ParagraphList const & parlist,
                                        if (ref.getParam("reference") == oldname)
                                                ref.setParam("reference", newname);
                                } else if (itt->lyxCode() == MATH_REF_CODE) {
-                                       InsetMathHull & mi =
-                                               static_cast<InsetMathHull &>(*itt);
+                                       InsetMathRef * mi = itt->asInsetMath()->asRefInset();
                                        // this is necessary to prevent an uninitialized
                                        // buffer when the RefInset is in a MathBox.
                                        // FIXME audit setBuffer calls
-                                       mi.setBuffer(const_cast<Buffer &>(buffer));
-                                       if (mi.asRefInset()->getTarget() == oldname)
-                                               mi.asRefInset()->changeTarget(newname);
+                                       mi->setBuffer(const_cast<Buffer &>(buffer));
+                                       if (mi->getTarget() == oldname)
+                                               mi->changeTarget(newname);
                                }
                        }
                        break;
@@ -1112,7 +1111,7 @@ void pasteSelection(Cursor & cur, ErrorList & errorList)
 }
 
 
-void replaceSelectionWithString(Cursor & cur, docstring const & str, bool backwards)
+void replaceSelectionWithString(Cursor & cur, docstring const & str)
 {
        cur.recordUndo();
        DocIterator selbeg = cur.selectionBegin();
@@ -1131,13 +1130,6 @@ void replaceSelectionWithString(Cursor & cur, docstring const & str, bool backwa
 
        // Cut the selection
        cutSelection(cur, true, false);
-
-       // select the replacement
-       if (backwards) {
-               selbeg.pos() += str.length();
-               cur.setSelection(selbeg, -int(str.length()));
-       } else
-               cur.setSelection(selbeg, str.length());
 }