]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTabular.cpp
Fix (again) bug #5754: Caption inset not dissolved when unsetting longtable caption...
[lyx.git] / src / insets / InsetTabular.cpp
index 1738869e18062fe9a2805ca0df7e36ea982c9c85..611e29f01b5a9a691b3c76ada4d1a9d98822665a 100644 (file)
@@ -548,6 +548,7 @@ Tabular::CellData::CellData(CellData const & cs)
          p_width(cs.p_width),
          inset(dynamic_cast<InsetTableCell *>(cs.inset->clone()))
 {
+       inset->setBuffer(cs.inset->buffer());
 }
 
 Tabular::CellData & Tabular::CellData::operator=(CellData cs)
@@ -1797,9 +1798,10 @@ Tabular::idx_type Tabular::setLTCaption(row_type row, bool what)
                setRightLine(i, false);
        } else {
                unsetMultiColumn(i);
-               // FIXME: when unsetting a caption row, also all existing captions
-               // in this row must be dissolved, see (bug 5754)
-               // dispatch(FuncRequest(LFUN_INSET_DISSOLVE, "caption-insert"));
+               // 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;
@@ -3510,11 +3512,11 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
                                && cur.pos() == cur.lastpos())
                                || (!next_cell && cur.pit() == 0 && cur.pos() == 0));
 
+                       bool const empty_cell = cur.lastpos() == 0 && cur.lastpit() == 0;
+
                        // ...try to dispatch to the cell's inset.
                        cell(cur.idx())->dispatch(cur, cmd);
 
-                       bool const empty_cell = cur.lastpos() == 0 && cur.lastpit() == 0;
-                       
                        // When we already have a selection we want to select the whole cell
                        // before going to the next cell.
                        if (select_whole && !empty_cell){