Fix crash when using down cursor in an empty math subscript (Bug 4117).

http://bugzilla.lyx.org/show_bug.cgi?id=4117 

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19689 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-08-21 08:17:07 +00:00
parent 920be91bec
commit 75e3b6a419
4 changed files with 18 additions and 5 deletions

View File

@ -1482,12 +1482,14 @@ Font Cursor::getFont() const
} }
void Cursor::fixIfBroken() bool Cursor::fixIfBroken()
{ {
if (DocIterator::fixIfBroken()) { if (DocIterator::fixIfBroken()) {
clearSelection(); clearSelection();
resetAnchor(); resetAnchor();
return true;
} }
return false;
} }

View File

@ -179,8 +179,9 @@ public:
* Not using noUpdate() should never be wrong. * Not using noUpdate() should never be wrong.
*/ */
void noUpdate(); void noUpdate();
/// fix cursor in circumstances that should never happen /// fix cursor in circumstances that should never happen.
void fixIfBroken(); /// \retval true if a fix occured.
bool fixIfBroken();
/// output /// output
friend std::ostream & operator<<(std::ostream & os, Cursor const & cur); friend std::ostream & operator<<(std::ostream & os, Cursor const & cur);

View File

@ -568,8 +568,16 @@ goto_char_backwards:
// notify left insets and give them chance to set update flags // notify left insets and give them chance to set update flags
lyx::notifyCursorLeaves(cur.beforeDispatchCursor(), cur); lyx::notifyCursorLeaves(cur.beforeDispatchCursor(), cur);
cur.fixIfBroken(); cur.fixIfBroken();
} else break;
cur.undispatched(); }
if (cur.fixIfBroken())
// FIXME: Something bad happened. We pass the corrected Cursor
// instead of letting things go worse.
break;
// We did not manage to move the cursor.
cur.undispatched();
break; break;
} }

View File

@ -76,6 +76,8 @@ What's new
- Fix crash when a user removes a formula when its preview is being generated. - Fix crash when a user removes a formula when its preview is being generated.
(gcc 3 only). (gcc 3 only).
- Fix crash when using down cursor in an empty math subscript (Bug 4117).
* DOCUMENTATION * DOCUMENTATION
- Embedded Objects manual: section about longtable alignment added - Embedded Objects manual: section about longtable alignment added