From 539061ddc89bb95b36a33f8419af5238d270f4e1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Sun, 2 Dec 2007 15:19:39 +0000 Subject: [PATCH] * src/insets/InsetTabular.cpp: - 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 5c6affae0b..76091c4e5d 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -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; } -- 2.39.5