From 1954458817f80ac15d670a9732469066994ef08a Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Wed, 12 Dec 2012 04:04:39 -0500 Subject: [PATCH] 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. --- src/insets/InsetTabular.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index a38c4b27a3..f8d868608a 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -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()) -- 2.39.2