X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText3.cpp;h=704adceac62febde4f794668ebcb5b3a94fd0360;hb=b8550d11e836e857967a31250e6ca248b2d43f82;hp=f810eceac5b8f27ffbd65626838398e51ca96f57;hpb=d65020b293ab208b1391f96a731e53e0c7274a02;p=lyx.git diff --git a/src/Text3.cpp b/src/Text3.cpp index f810eceac5..704adceac6 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -198,7 +198,7 @@ static void mathDispatch(Cursor & cur, FuncRequest const & cmd, bool display) void regexpDispatch(Cursor & cur, FuncRequest const & cmd) { - BOOST_ASSERT(cmd.action == LFUN_REGEXP_MODE); + LASSERT(cmd.action == LFUN_REGEXP_MODE, return); if (cur.inRegexped()) { cur.message(_("Already in regular expression mode")); return; @@ -1571,6 +1571,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) case LFUN_MARGINALNOTE_INSERT: case LFUN_OPTIONAL_INSERT: case LFUN_INDEX_INSERT: + case LFUN_PREVIEW_INSERT: // Open the inset, and move the current selection // inside it. doInsertInset(cur, this, cmd, true, true); @@ -2275,11 +2276,24 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, // not allowed in description items enable = !inDescriptionItem(cur); break; - case LFUN_FLOAT_LIST_INSERT: + case LFUN_FLOAT_LIST_INSERT: { code = FLOAT_LIST_CODE; // not allowed in description items enable = !inDescriptionItem(cur); + if (enable) { + FloatList const & floats = cur.buffer()->params().documentClass().floats(); + FloatList::const_iterator cit = floats[to_ascii(cmd.argument())]; + // make sure we know about such floats + if (cit == floats.end() || + // and that we know how to generate a list of them + (!cit->second.needsFloatPkg() && cit->second.listCommand().empty())) { + flag.unknown(true); + // probably not necessary, but... + enable = false; + } + } break; + } case LFUN_CAPTION_INSERT: code = CAPTION_CODE; // not allowed in description items @@ -2375,6 +2389,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, if (cur.inTexted()) code = SPACE_CODE; break; + case LFUN_PREVIEW_INSERT: + code = PREVIEW_CODE; + break; case LFUN_MATH_INSERT: case LFUN_MATH_AMS_MATRIX: