fix bug 3204

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@17347 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2007-02-25 21:07:10 +00:00
parent 474973d3cb
commit fba95df450
3 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2007-02-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyx_cb.C (InsertAsciiFile): delete selection before insertion
and handle undo correctly (bug 3204)
2007-01-31 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* buffer.C (readFile): reword error message when lyx2lyx fails.

View File

@ -21,6 +21,7 @@
#include "BufferView.h"
#include "buffer_funcs.h"
#include "cursor.h"
#include "CutAndPaste.h"
#include "debug.h"
#include "gettext.h"
#include "lastfiles.h"
@ -30,6 +31,7 @@
#include "lyxrc.h"
#include "lyxtext.h"
#include "paragraph.h"
#include "undo.h"
#include "frontends/Alert.h"
#include "frontends/FileDialog.h"
@ -368,13 +370,13 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
if (tmpstr.empty())
return;
// clear the selection
if (bv->text() == bv->getLyXText())
bv->cursor().clearSelection();
LCursor & cur = bv->cursor();
lyx::cap::replaceSelection(cur);
recordUndo(cur);
if (asParagraph)
bv->getLyXText()->insertStringAsParagraphs(bv->cursor(), tmpstr);
cur.innerText()->insertStringAsParagraphs(cur, tmpstr);
else
bv->getLyXText()->insertStringAsLines(bv->cursor(), tmpstr);
cur.innerText()->insertStringAsLines(cur, tmpstr);
bv->update();
}

View File

@ -25,6 +25,7 @@ What's new
* USER INTERFACE:
- Handle undo correctly when inserting a plain text file (bug 3204).
* DOCUMENTATION AND LOCALIZATION