]> git.lyx.org Git - lyx.git/commitdiff
Fix DEPM at end of paragraph
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 30 Jan 2019 22:50:53 +0000 (23:50 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 15 Feb 2019 10:01:29 +0000 (11:01 +0100)
Remove special handling of spaces at end of paragraph. Now they are
handled like interword spaces by both DEPM methods.

Fix off-by-one error in loop when testing for end of paragraph.

Part of bug #11412.

(adapted from commit c00234503f9e07795723222e6095c022e45ad1dd)

src/Text2.cpp

index bcd38f447c2b39386cbe5d2770c16d9f432a169d..34fe1caecb495384d9df0426a5751eb7ae73428c 100644 (file)
@@ -860,13 +860,13 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur,
                       && !oldpar.isDeleted(from - 1))
                        --from;
                int to = old.pos();
-               while (to < oldpar.size() - 1
+               while (to < oldpar.size()
                       && oldpar.isLineSeparator(to)
                       && !oldpar.isDeleted(to))
                        ++to;
 
-               // If we are not at the extremity of the paragraph, keep one space
-               if (from != to && from > 0 && to < oldpar.size())
+               // 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)