Fix result of deleteSpaces()

With change tracking on, spaces that are marked as ADDED are really
removed (and not marked deleted) if the changeAuthor is the current
author; see Paragraph::eraseChar().

The function tried to account for that but had the logic upside down.

Consequently actually deleted spaces haven't been counted and the
result was off.

This fixes an assertion when pasting in CT parts with deleted stuff
(#12901)
This commit is contained in:
Juergen Spitzmueller 2023-09-13 13:31:55 +02:00
parent 81dc79e6d6
commit 91186013ba

View File

@ -3215,7 +3215,7 @@ int deleteSpaces(Paragraph & par, pos_type const from, pos_type to,
int pos = from; int pos = from;
while (pos < to && num_spaces > 0) { while (pos < to && num_spaces > 0) {
Change const & change = par.lookupChange(pos); Change const & change = par.lookupChange(pos);
if (change.inserted() && change.currentAuthor()) { if (change.inserted() && !change.currentAuthor()) {
par.eraseChar(pos, trackChanges); par.eraseChar(pos, trackChanges);
--num_spaces; --num_spaces;
--to; --to;