mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
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:
parent
d088ebfbae
commit
a22bf49a4e
@ -52,7 +52,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
#define FILEDEBUG 0
|
//#define FILEDEBUG 1
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::min;
|
using std::min;
|
||||||
@ -173,7 +173,7 @@ bool MathCursor::openable(MathAtom const & t, bool sel) const
|
|||||||
if (t->asScriptInset())
|
if (t->asScriptInset())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (sel) {
|
if (!sel) {
|
||||||
// we can't move into anything new during selection
|
// we can't move into anything new during selection
|
||||||
if (depth() == Anchor_.size())
|
if (depth() == Anchor_.size())
|
||||||
return false;
|
return false;
|
||||||
@ -339,6 +339,7 @@ void MathCursor::markErase()
|
|||||||
|
|
||||||
void MathCursor::plainInsert(MathAtom const & t)
|
void MathCursor::plainInsert(MathAtom const & t)
|
||||||
{
|
{
|
||||||
|
dump("plainInsert");
|
||||||
array().insert(pos(), t);
|
array().insert(pos(), t);
|
||||||
++pos();
|
++pos();
|
||||||
}
|
}
|
||||||
@ -436,7 +437,7 @@ void MathCursor::backspace()
|
|||||||
{
|
{
|
||||||
autocorrect_ = false;
|
autocorrect_ = false;
|
||||||
if (pos() == 0) {
|
if (pos() == 0) {
|
||||||
pullArg(false);
|
pullArg();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,7 +815,7 @@ void MathCursor::popToEnclosingHull()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathCursor::pullArg(bool goright)
|
void MathCursor::pullArg()
|
||||||
{
|
{
|
||||||
dump("pullarg");
|
dump("pullarg");
|
||||||
MathArray a = array();
|
MathArray a = array();
|
||||||
@ -835,8 +836,7 @@ void MathCursor::pullArg(bool goright)
|
|||||||
if (popLeft()) {
|
if (popLeft()) {
|
||||||
plainErase();
|
plainErase();
|
||||||
array().insert(pos(), a);
|
array().insert(pos(), a);
|
||||||
if (goright)
|
Anchor_ = Cursor_;
|
||||||
pos() += a.size();
|
|
||||||
} else {
|
} else {
|
||||||
formula()->mutateToText();
|
formula()->mutateToText();
|
||||||
}
|
}
|
||||||
|
@ -176,8 +176,6 @@ public:
|
|||||||
/// remove this as soon as LyXFunc::getStatus is "localized"
|
/// remove this as soon as LyXFunc::getStatus is "localized"
|
||||||
string getLastCode() const { return "mathnormal"; }
|
string getLastCode() const { return "mathnormal"; }
|
||||||
///
|
///
|
||||||
void pullArg(bool goright);
|
|
||||||
///
|
|
||||||
bool isInside(MathInset const *) const;
|
bool isInside(MathInset const *) const;
|
||||||
///
|
///
|
||||||
char valign() const;
|
char valign() const;
|
||||||
@ -266,6 +264,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// injects content of a cell into parent
|
||||||
|
void pullArg();
|
||||||
/// moves cursor index one cell to the left
|
/// moves cursor index one cell to the left
|
||||||
bool idxLeft();
|
bool idxLeft();
|
||||||
/// moves cursor index one cell to the right
|
/// moves cursor index one cell to the right
|
||||||
|
Loading…
Reference in New Issue
Block a user