]> git.lyx.org Git - features.git/commitdiff
* src/insets/InsetTabular.cpp:
authorJürgen Spitzmüller <spitz@lyx.org>
Sun, 2 Dec 2007 15:19:39 +0000 (15:19 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sun, 2 Dec 2007 15:19:39 +0000 (15:19 +0000)
- sanitize cursor after insertion via LFUN_CLIPBOARD_PASTE
   or LFUN_FILE_INSERT_PLAINTEXT (bug 4368).

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

src/insets/InsetTabular.cpp

index 5c6affae0b50ade0876afc32cece4bd8e2aee3ca..76091c4e5d0ac52f11d0143e451d4f04e3cdb8a2 100644 (file)
@@ -3412,7 +3412,16 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
                // FIXME UNICODE
                docstring const tmpstr = cur.bv().contentsOfPlaintextFile(
                        FileName(to_utf8(cmd.argument())), false);
-               if (!tmpstr.empty() && !insertPlaintextString(cur.bv(), tmpstr, false))
+               if (tmpstr.empty())
+                       break;
+               cur.recordUndoInset(INSERT_UNDO);
+               if (insertPlaintextString(cur.bv(), tmpstr, false)) {
+                       // content has been replaced,
+                       // so cursor might be invalid
+                       cur.pos() = cur.lastpos();
+                       cur.pit() = cur.lastpit();
+                       bvcur.setCursor(cur);
+               } else
                        cur.undispatched();
                break;
        }
@@ -3463,6 +3472,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
                                // content has been replaced,
                                // so cursor might be invalid
                                cur.pos() = cur.lastpos();
+                               cur.pit() = cur.lastpit();
                                bvcur.setCursor(cur);
                                break;
                        }