diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 1c9da8cc52..5c2b3dee16 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -138,7 +138,8 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const dim = dimensionCollapsed(); if (status() == Open) { InsetText::metrics(mi, textdim_); - openinlined_ = textdim_.wid + 2 * dim.wid <= mi.base.textwidth; + // This expression should not contain mi.base.texwidth + openinlined_ = textdim_.wid < 0.5 * mi.base.bv->workWidth(); if (openinlined_) { // Correct for button width, and re-fit mi.base.textwidth -= dim.wid; diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 3f9fabe9ba..25dc58b664 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -274,9 +274,15 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const tabular.getCellInset(cell)->metrics(m, dim); if (!p_width.zero()) dim.wid = m.base.textwidth; + tabular.setWidthOfCell(cell, dim.wid); + if (p_width.zero()) { + m.base.textwidth = dim.wid + 2 * ADD_TO_TABULAR_WIDTH; + // FIXME there must be a way to get rid of + // the second metrics call + tabular.getCellInset(cell)->metrics(m, dim); + } maxAsc = max(maxAsc, dim.asc); maxDesc = max(maxDesc, dim.des); - tabular.setWidthOfCell(cell, dim.wid); ++cell; } int const top_space = tabular.row_info[i].top_space_default ?