Improve DEPM when change tracking is on

A typical problem when change tracking is on is:
1/ insert a new space between two words (as if you want to insert a new one)
2/ move the cursor
3/ see how one has one inserted and one deleted space, whereas one would expect nothing.

The problem is fixed in a general way in master, but here we propose
a simpler one, where the spaces that we keep are the ones at the end
of the sequence of spaces.

Part of #11412.
This commit is contained in:
Jean-Marc Lasgouttes 2019-01-29 11:20:22 +01:00
parent 484128d05b
commit 7f177d8d4a

View File

@ -866,11 +866,12 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur,
++to;
// If we are not at the start of the paragraph, keep one space
if (from != to && from > 0)
++from;
if (same_par && cur.pos() >= from && cur.pos() < to)
++from;
if (from != to && from > 0) {
--to;
// if the new cursor is inside the sequence of spaces, keep one more space
if (same_par && cur.pos() > from && cur.pos() <= to)
--to;
}
// Remove spaces and adapt cursor.
if (from < to) {