[LyX/master] Fix application of PARAGRAPH_PARAMS* in selection.

Pavel Sanda sanda at lyx.org
Sat Jul 22 15:04:13 UTC 2023


commit fe953000edec324b473e0165ed65f15b069909c1
Author: Pavel Sanda <sanda at lyx.org>
Date:   Sat Jul 22 17:46:23 2023 +0200

    Fix application of PARAGRAPH_PARAMS* in selection.
    
    - Setting in the last paragraph of selection was not applied
      at certain conditions (i.e. relative cursor position in first
      paragraph > rel.c.pos. in last paragraph).
    
    Getting back + fixing typo from e2b42b17265f.
    
    https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg220019.html
---
 src/Text.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index dfef748..9850f55 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -2908,7 +2908,8 @@ void Text::setParagraphs(Cursor const & cur, docstring const & arg, bool merge)
 	Layout priorlayout;
 	Cursor c(cur.bv());
 	c.setCursor(cur.selectionBegin());
-	for ( ; c <= cur.selectionEnd() ; ++c.pit()) {
+	pit_type const last_pit = cur.selectionEnd().pit();
+	for ( ; c.pit() <= last_pit ; ++c.pit()) {
 		Paragraph & par = c.paragraph();
 		ParagraphParameters params = par.params();
 		params.read(argument, merge);
@@ -2934,7 +2935,8 @@ void Text::setParagraphs(Cursor const & cur, ParagraphParameters const & p)
 	Layout priorlayout;
 	Cursor c(cur.bv());
 	c.setCursor(cur.selectionBegin());
-	for ( ; c < cur.selectionEnd() ; ++c.pit()) {
+	pit_type const last_pit = cur.selectionEnd().pit();
+	for ( ; c.pit() <= last_pit ; ++c.pit()) {
 		Paragraph & par = c.paragraph();
 		// Changes to label width string apply to all paragraphs
 		// with same layout in a sequence.


More information about the lyx-cvs mailing list