-namespace {
-// fix the cursor `cur' after characters has been deleted at `where'
-// position. Called by deleteEmptyParagraphMechanism
-void fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where,
- pos_type from, pos_type to)
-{
- // Do nothing if cursor is not in the paragraph where the
- // deletion occurred,
- if (cur.pit() != where.pit())
- return;
-
- // If cursor position is after the deletion place update it
- if (cur.pos() > from)
- cur.pos() = max(from, cur.pos() - (to - from));
-
- // Check also if we don't want to set the cursor on a spot behind the
- // pagragraph because we erased the last character.
- if (cur.pos() > cur.lastpos())
- cur.pos() = cur.lastpos();
-}
-
-}
-
-