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
This commit is contained in:
Uwe Stöhr 2009-08-15 22:53:15 +00:00
parent 2595c689bd
commit f7aa1c1c5d

View 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"));
}