// and selection.end
// make sure that the depth behind the selection are restored, too
- ParagraphList::iterator endpit = getPar(selection.end.par() + 1);
+ ParagraphList::iterator endpit = boost::next(getPar(selection.end.par()));
ParagraphList::iterator undoendpit = endpit;
ParagraphList::iterator pars_end = ownerParagraphs().end();
if (selection.set())
return false;
+ // Don't do anything if the cursor is invalid
+ if (old_cursor.par() == -1)
+ return false;
+
// We allow all kinds of "mumbo-jumbo" when freespacing.
- if (getPar(old_cursor)->isFreeSpacing())
+ ParagraphList::iterator const old_pit = getPar(old_cursor);
+ if (old_pit->isFreeSpacing())
return false;
/* Ok I'll put some comments here about what is missing.
// MISSING
// If the pos around the old_cursor were spaces, delete one of them.
- ParagraphList::iterator const old_pit = getPar(old_cursor);
if (old_cursor.par() != cursor.par()
|| old_cursor.pos() != cursor.pos()) {
deleted = true;
- bool selection_position_was_oldcursor_position =
+ bool selection_position_was_oldcursor_position =
selection.cursor.par() == old_cursor.par()
&& selection.cursor.pos() == old_cursor.pos();