]> git.lyx.org Git - features.git/commitdiff
When pasting into mathed, take into account the current mode.
authorEnrico Forestieri <forenr@lyx.org>
Sat, 18 Oct 2008 09:06:27 +0000 (09:06 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Sat, 18 Oct 2008 09:06:27 +0000 (09:06 +0000)
For example, this allows to paste something like $x$ to a textmode
inset and get the expected result. If $x$ is pasted in mathmode,
it is pasted verbatim, such that no compile errors can arise.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26935 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathNest.cpp

index aa79ed0f78071f22170dea063f7c334b54a88ae4..52c79f458ab8c3ded29179f664e43cf0a2b86ee7 100644 (file)
@@ -1251,6 +1251,8 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                parseflg |= Parse::VERBATIM;
                // fall through
        case LFUN_PASTE: {
+               if (cur.currentMode() == TEXT_MODE)
+                       parseflg |= Parse::TEXTMODE;
                cur.message(_("Paste"));
                cap::replaceSelection(cur);
                docstring topaste;
index a1f739afb90fe1106c803a676e74a44886894190..591e3609e47f270ef065b6b1fa9ba7802b06bf00 100644 (file)
@@ -521,6 +521,8 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                parseflg |= Parse::VERBATIM;
                // fall through
        case LFUN_PASTE: {
+               if (cur.currentMode() == TEXT_MODE)
+                       parseflg |= Parse::TEXTMODE;
                cur.recordUndoSelection();
                cur.message(_("Paste"));
                replaceSelection(cur);