Am Samstag, dem 13.07.2024 um 17:18 +0100 schrieb José Matos:
> On Fri, 2024-07-12 at 23:14 -0500, T Rex wrote:
> > The file and the backtrace:
> > 
> > 
> > /usr/include/c++/13.2.0/bits/stl_vector.h:1232: std::vector<_Tp,
> > _Alloc>::reference std::vector<_Tp, _Alloc>::back() [with _Tp =
> > lyx::CursorSlice; _Alloc = std::allocator<lyx::CursorSlice>;
> > reference = lyx::CursorSlice&]: Assertion '!this->empty()' failed.
> 
> I can reproduce this problem following the recipe.
> 
> The full backtrace follows attached.

I think the attached patch fixes it.

-- 
Jürgen
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index aae8b30bff..f72169ae66 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -240,7 +240,7 @@ int findForward(DocIterator & cur, DocIterator const endcur,
 		bool find_del = true, bool onlysel = false)
 {
 	for (; cur; cur.forwardChar()) {
-		if (onlysel && endcur.pit() == cur.pit()
+		if (onlysel && cur.inTexted() && endcur.pit() == cur.pit()
 		    && endcur.idx() == cur.idx() && endcur.pos() < cur.pos())
 			break;
 		if (cur.inTexted()) {
@@ -259,7 +259,7 @@ int findBackwards(DocIterator & cur, DocIterator const endcur,
 {
 	while (cur) {
 		cur.backwardChar();
-		if (onlysel && endcur.pit() == cur.pit()
+		if (onlysel && cur.inTexted() && endcur.pit() == cur.pit()
 		    && endcur.idx() == cur.idx() && endcur.pos() > cur.pos())
 			break;
 		if (cur.inTexted()) {
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to