From a6325095c4ab830a8ebb3b176313b200ebde1dab Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 24 Apr 2013 18:31:34 +0200 Subject: [PATCH] Fix bug #8633: change tracking: paragraph break is restored by undo A recordUndo call was missing in this case. --- src/Text.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Text.cpp b/src/Text.cpp index 932a3929d7..86fd90360e 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -1632,11 +1632,13 @@ bool Text::backspace(Cursor & cur) if (cur.pit() == 0) return dissolveInset(cur); - Paragraph & prev_par = pars_[cur.pit() - 1]; + Cursor prev_cur = cur; + --prev_cur.pit(); - if (!prev_par.isMergedOnEndOfParDeletion(cur.buffer()->params().trackChanges)) { - prev_par.setChange(prev_par.size(), Change(Change::DELETED)); - setCursorIntern(cur, cur.pit() - 1, prev_par.size()); + if (!prev_cur.paragraph().isMergedOnEndOfParDeletion(cur.buffer()->params().trackChanges)) { + cur.recordUndo(ATOMIC_UNDO, prev_cur.pit(), prev_cur.pit()); + prev_cur.paragraph().setChange(prev_cur.lastpos(), Change(Change::DELETED)); + setCursorIntern(cur, prev_cur.pit(), prev_cur.lastpos()); return true; } // The cursor is at the beginning of a paragraph, so