]> git.lyx.org Git - lyx.git/commitdiff
Don't allow captions in non-floating listings
authorEnrico Forestieri <forenr@lyx.org>
Wed, 7 Jun 2017 16:15:59 +0000 (18:15 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Wed, 7 Jun 2017 16:15:59 +0000 (18:15 +0200)
It was possible to insert a caption in a listing not marked as
floating. This didn't cause errors but the caption simply was
disappearing in the output.

src/insets/InsetListings.cpp

index b5a5701817aebe74db5e876179c281a065e02400..033b72ea2cba69eacd55871a73c58a238f529a22 100644 (file)
@@ -418,7 +418,8 @@ bool InsetListings::getStatus(Cursor & cur, FuncRequest const & cmd,
                        return true;
                case LFUN_CAPTION_INSERT: {
                        // the inset outputs at most one caption
-                       if (params().isInline() || getCaptionInset()) {
+                       if (params().isInline() || !params().isFloat()
+                                               || getCaptionInset()) {
                                status.setEnabled(false);
                                return true;
                        }