From 8384fa41233a2b941793210f49052d48461b4a74 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 22 Nov 2009 17:10:56 +0000 Subject: [PATCH] Better fix for bug #5754: Caption inset not dissolved when unsetting longtable caption. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32153 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetTabular.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 476541f1e2..2affeaaf51 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -1800,8 +1800,6 @@ Tabular::idx_type Tabular::setLTCaption(row_type row, bool what) unsetMultiColumn(i); // When unsetting a caption row, also all existing // captions in this row must be dissolved. - lyx::dispatch(FuncRequest(LFUN_LINE_BEGIN)); - lyx::dispatch(FuncRequest(LFUN_INSET_DISSOLVE, "caption")); } row_info[row].caption = what; return i; @@ -4876,15 +4874,21 @@ void InsetTabular::tabularFeatures(Cursor & cur, break; case Tabular::TOGGLE_LTCAPTION: { - bool set = !tabular.ltCaption(row); + bool const set = !tabular.ltCaption(row); cur.idx() = tabular.setLTCaption(row, set); cur.pit() = 0; cur.pos() = 0; cur.setSelection(false); - // When a row is set as caption, then also insert a caption. Otherwise - // the LaTeX output is broken, when the user doesn't add a caption. + if (set) + // When a row is set as caption, then also insert + // a caption. Otherwise the LaTeX output is broken. lyx::dispatch(FuncRequest(LFUN_CAPTION_INSERT)); + else { + FuncRequest fr(LFUN_INSET_DISSOLVE, "caption"); + if (lyx::getStatus(fr).enabled()) + lyx::dispatch(fr); + } break; } -- 2.39.2