[LyX/master] Update caret if needed when changing depth

Jean-Marc Lasgouttes lasgouttes at lyx.org
Wed Aug 30 10:29:08 UTC 2023


commit 0912f7c35636443ecb7cc419ac7cd118c2b91ca8
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Wed Aug 30 13:45:00 2023 +0200

    Update caret if needed when changing depth
    
    Fixes bug #12856.
---
 src/Text.cpp |    3 ++-
 src/Text.h   |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 3a8be76..dcac8ff 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -2648,7 +2648,7 @@ bool Text::changeDepthAllowed(Cursor const & cur, DEPTH_CHANGE type) const
 }
 
 
-void Text::changeDepth(Cursor const & cur, DEPTH_CHANGE type)
+void Text::changeDepth(Cursor & cur, DEPTH_CHANGE type)
 {
 	LBUFERR(this == cur.text());
 	pit_type const beg = cur.selBegin().pit();
@@ -2667,6 +2667,7 @@ void Text::changeDepth(Cursor const & cur, DEPTH_CHANGE type)
 		}
 		max_depth = par.getMaxDepthAfter();
 	}
+	cur.setCurrentFont();
 	// this handles the counter labels, and also fixes up
 	// depth values for follow-on (child) paragraphs
 	cur.forceBufferUpdate();
diff --git a/src/Text.h b/src/Text.h
index 01d47d6..45fb69c 100644
--- a/src/Text.h
+++ b/src/Text.h
@@ -94,7 +94,7 @@ public:
 	};
 	/// Increase or decrease the nesting depth of the selected paragraph(s)
 	/// FIXME: replace Cursor with DocIterator.
-	void changeDepth(Cursor const & cur, DEPTH_CHANGE type);
+	void changeDepth(Cursor & cur, DEPTH_CHANGE type);
 
 	/// Returns whether something would be changed by changeDepth
 	/// FIXME: replace Cursor with DocIterator.


More information about the lyx-cvs mailing list