Am Montag, 4. Februar 2019 17:06:35 CET schrieb Kornel Benko <kor...@lyx.org>:
> Endles loop in src/Text2.cpp:955-977
> 
> Debugging I get
> 954:    from = 0
> 955:    par.size() = 28
> while (from < par.size()) {
> ...
>         from = 4
>         par.isDeleted(from) = true
>         par.isLineSeparator(from) = true
>         to = 4
> inside "while (to < par.size()"
>         par.isLineSeparator(to) = true
>         par.isDeleted(to) = false
>         to++ ( == 5)
>         par.isLineSeparator(to) = false
>         par.isDeleted(to) = false
> 969:    num_spaces = 1
> 973:    num_spaces = 0
> 976:    deleteSpaces(par, from , to, num_spaces, trackChanges);
> 
> Repeat the while-loop at 955
> 

This patch works for me

        Kornel
diff --git a/src/Text2.cpp b/src/Text2.cpp
index ae35fad..832f4c1 100644
--- a/src/Text2.cpp
+++ b/src/Text2.cpp
@@ -972,10 +972,12 @@ void Text::deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool tra
 			if (from != to && from > 0 && to < par.size())
 				--num_spaces;
 
 			// Remove spaces if needed
 			deleteSpaces(par, from , to, num_spaces, trackChanges);
+			if (num_spaces == 0)
+				from++;
 		}
 
 		// don't delete anything if this is the only remaining paragraph
 		// within the given range. Note: Text::acceptOrRejectChanges()
 		// sets the cursor to 'first' after calling DEPM

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to