[LyX/2.5.x] Fix crash when testing changes in selection

Jean-Marc Lasgouttes <[email protected]> Wed, 06 May 2026 20:14:47 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit bb5eeb0852c250846c15f1c9208dd3e6e07b2a04
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Fri Apr 3 16:33:25 2026 +0200

    Fix crash when testing changes in selection
    
    Testing for pit() and idx() is not enough, it is better to use
    directly id(), as was done originally in 23de5e5e.
    
    Fixes bug #13294.
    
    (cherry picked from commit 8ac6770da10ae901cf5b01f184a7930c7f4cf438)
---
 src/Text.cpp | 4 ++--
 status.25x   | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 6b109e85ba..f710b753ff 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -6902,8 +6902,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
 			for (DocIterator it = cur.selectionBegin(); ; it.forwardPar()) {
 				pos_type const beg = it.pos();
 				pos_type end;
-				bool const in_last_par = (it.pit() == cur.selectionEnd().pit() &&
-							  it.idx() == cur.selectionEnd().idx());
+				bool const in_last_par
+					= (it.paragraph().id() == cur.selectionEnd().paragraph().id());
 				if (in_last_par)
 					end = cur.selectionEnd().pos();
 				else
diff --git a/status.25x b/status.25x
index b85f5a58f9..696d91883f 100644
--- a/status.25x
+++ b/status.25x
@@ -61,6 +61,8 @@ What's new
 
 * USER INTERFACE
 
+- Fix crash when selecting inset (bug 13294).
+
 - Consider longtable caption when adding new column (bug 13299).
 
 - Load externally referred buffers and initialize their labels.
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs