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.
++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) {