[LyX/master] Fix result of deleteSpaces()

Juergen Spitzmueller spitz at lyx.org
Wed Sep 13 10:33:45 UTC 2023


commit 91186013ba84382a3863a56e09e090b555fd4afa
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Wed Sep 13 13:31:55 2023 +0200

    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)
---
 src/Text.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index dcac8ff..e8fd9d4 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -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;


More information about the lyx-cvs mailing list