void Tabular::updateIndexes()
{
+ setBuffer(buffer());
col_type ncols = column_info.size();
row_type nrows = row_info.size();
numberofcells = 0;
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;
break;
case Tabular::UNSET_LONGTABULAR:
+ for (row_type i = 0; i < tabular.row_info.size(); ++i) {
+ if (tabular.ltCaption(i)) {
+ cur.idx() = tabular.cellIndex(i, 0);
+ cur.pit() = 0;
+ cur.pos() = 0;
+ tabularFeatures(cur, Tabular::TOGGLE_LTCAPTION);
+ }
+ }
tabular.is_long_tabular = false;
break;
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;
}