Keep outer tabular borders when delete row/column

Fix #4981:
If the first or last column is deleted, the borders are preserved.
Similarly for the last row, but not for the first row.  Selections are
supported.

Based on a patch by Zahari Dimitrov.
This commit is contained in:
Scott Kostyshak 2012-12-12 04:04:39 -05:00
parent 4b706051b7
commit 1954458817

View File

@ -5313,6 +5313,12 @@ void InsetTabular::tabularFeatures(Cursor & cur,
break;
case Tabular::DELETE_ROW:
if (sel_row_end == tabular.nrows() - 1 && sel_row_start != 0) {
for (col_type c = 0; c < tabular.ncols(); c++)
tabular.setBottomLine(tabular.cellIndex(sel_row_start - 1, c),
tabular.bottomLine(tabular.cellIndex(sel_row_end, c)));
}
for (row_type r = sel_row_start; r <= sel_row_end; ++r)
tabular.deleteRow(sel_row_start);
if (sel_row_start >= tabular.nrows())
@ -5324,6 +5330,18 @@ void InsetTabular::tabularFeatures(Cursor & cur,
break;
case Tabular::DELETE_COLUMN:
if (sel_col_end == tabular.ncols() - 1 && sel_col_start != 0) {
for (row_type r = 0; r < tabular.nrows(); r++)
tabular.setRightLine(tabular.cellIndex(r, sel_col_start - 1),
tabular.rightLine(tabular.cellIndex(r, sel_col_end)));
}
if (sel_col_start == 0 && sel_col_end != tabular.ncols() - 1) {
for (row_type r = 0; r < tabular.nrows(); r++)
tabular.setLeftLine(tabular.cellIndex(r, sel_col_end + 1),
tabular.leftLine(tabular.cellIndex(r, 0)));
}
for (col_type c = sel_col_start; c <= sel_col_end; ++c)
tabular.deleteColumn(sel_col_start);
if (sel_col_start >= tabular.ncols())