]> git.lyx.org Git - features.git/commitdiff
* insettabular.C (doDispatch):
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 22 May 2006 10:19:27 +0000 (10:19 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 22 May 2006 10:19:27 +0000 (10:19 +0000)
fix crash due to invalidated
cursor after insertAciiString (bug 2603).

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

src/insets/insettabular.C

index 8f7962c56ddc31f29da5c01042936d33a5ac2a73..8e597896ff14f952fbdf19ca447db218cbd6aca3 100644 (file)
@@ -668,9 +668,17 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
                string const clip = cur.bv().getClipboard();
                if (clip.empty())
                        break;
-               if (insertAsciiString(cur.bv(), clip, false))
-                       break;
-               else {
+               // pass to InsertAsciiString, but
+               // only if we have multi-cell content
+               if (clip.find_first_of("\t\n") != string::npos) {
+                       if (insertAsciiString(cur.bv(), clip, false)) {
+                               // content has been replaced,
+                               // so cursor might be invalid
+                               cur.pos() = cur.lastpos();
+                               bvcur.setCursor(cur);
+                               break;
+                       }
+               } else {
                        // so that the clipboard is used and it goes on
                        // to default
                        // and executes LFUN_PRIMARY_SELECTION_PASTE in insettext!