]> git.lyx.org Git - features.git/commitdiff
Text3.cpp: fix crash reported in #6133, patch from Tommaso
authorUwe Stöhr <uwestoehr@web.de>
Sat, 15 Aug 2009 22:53:15 +0000 (22:53 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Sat, 15 Aug 2009 22:53:15 +0000 (22:53 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31070 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text3.cpp

index b551f96397a37e3faef02e1ed2393494e2471235..f89326cd1ed0bc22819f03523610c8cd74bbbca0 100644 (file)
@@ -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"));
 }