fix nasty crash when selection anchor pointed to a deleted cell

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4791 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-07-26 07:39:13 +00:00
parent d088ebfbae
commit a22bf49a4e
2 changed files with 8 additions and 8 deletions

View File

@ -52,7 +52,7 @@
#include <algorithm>
#include <cctype>
#define FILEDEBUG 0
//#define FILEDEBUG 1
using std::endl;
using std::min;
@ -173,7 +173,7 @@ bool MathCursor::openable(MathAtom const & t, bool sel) const
if (t->asScriptInset())
return false;
if (sel) {
if (!sel) {
// we can't move into anything new during selection
if (depth() == Anchor_.size())
return false;
@ -339,6 +339,7 @@ void MathCursor::markErase()
void MathCursor::plainInsert(MathAtom const & t)
{
dump("plainInsert");
array().insert(pos(), t);
++pos();
}
@ -436,7 +437,7 @@ void MathCursor::backspace()
{
autocorrect_ = false;
if (pos() == 0) {
pullArg(false);
pullArg();
return;
}
@ -814,7 +815,7 @@ void MathCursor::popToEnclosingHull()
}
void MathCursor::pullArg(bool goright)
void MathCursor::pullArg()
{
dump("pullarg");
MathArray a = array();
@ -835,8 +836,7 @@ void MathCursor::pullArg(bool goright)
if (popLeft()) {
plainErase();
array().insert(pos(), a);
if (goright)
pos() += a.size();
Anchor_ = Cursor_;
} else {
formula()->mutateToText();
}

View File

@ -176,8 +176,6 @@ public:
/// remove this as soon as LyXFunc::getStatus is "localized"
string getLastCode() const { return "mathnormal"; }
///
void pullArg(bool goright);
///
bool isInside(MathInset const *) const;
///
char valign() const;
@ -266,6 +264,8 @@ public:
private:
/// injects content of a cell into parent
void pullArg();
/// moves cursor index one cell to the left
bool idxLeft();
/// moves cursor index one cell to the right