LFUN_INFO_INSERT: avoid static_cast.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25155 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-06-06 09:01:55 +00:00
parent 81cc98a500
commit b4213b9fe5

View File

@ -1338,18 +1338,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
} }
case LFUN_INFO_INSERT: { case LFUN_INFO_INSERT: {
Inset * inset = createInset(cur.bv().buffer(), cmd); Inset * inset;
if (!inset)
break;
// if an empty inset is created (cmd.argument() is empty)
// use current selection as parameter.
if (cmd.argument().empty() && cur.selection()) { if (cmd.argument().empty() && cur.selection()) {
// use selected text as info to avoid a separate UI // if command argument is empty use current selection as parameter.
docstring ds = cur.selectionAsString(false); docstring ds = cur.selectionAsString(false);
cutSelection(cur, true, false); cutSelection(cur, true, false);
static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds)); FuncRequest cmd0(cmd, ds);
static_cast<InsetInfo *>(inset)->updateInfo(); inset = createInset(cur.bv().buffer(), cmd0);
} else {
inset = createInset(cur.bv().buffer(), cmd);
} }
if (!inset)
break;
insertInset(cur, inset); insertInset(cur, inset);
cur.posForward(); cur.posForward();
break; break;