From f7aa1c1c5da8b55e62c15ba5c117dbecd50468c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Sat, 15 Aug 2009 22:53:15 +0000 Subject: [PATCH] Text3.cpp: fix crash reported in #6133, patch from Tommaso git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31070 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text3.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Text3.cpp b/src/Text3.cpp index b551f96397..f89326cd1e 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -204,13 +204,14 @@ void regexpDispatch(Cursor & cur, FuncRequest const & cmd) return; } cur.recordUndo(); - docstring const save_selection = grabAndEraseSelection(cur); - selClearOrDel(cur); - // replaceSelection(cur); + docstring sel = cur.selectionAsString(false); + + // It may happen that sel is empty but there is a selection + replaceSelection(cur); cur.insert(new InsetMathHull(hullRegexp)); cur.nextInset()->edit(cur, true); - cur.niceInsert(save_selection); + cur.niceInsert(sel); cur.message(_("Regexp editor mode")); }