]> git.lyx.org Git - features.git/commitdiff
Fix result of deleteSpaces()
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 13 Sep 2023 11:31:55 +0000 (13:31 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 13 Sep 2023 11:50:40 +0000 (13:50 +0200)
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)

src/Text.cpp

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