The attached patch is based on a patch sent by Zahari Dimitrov in this email: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg172590.html
I have tested it. Can it go in to trunk? Should he send a GPL statement? Thanks, Scott
From 317e78f5d70fc926da3fb01b0e443f7ded2e0e1f Mon Sep 17 00:00:00 2001 From: Scott Kostyshak <skost...@lyx.org> Date: Fri, 7 Dec 2012 01:55:28 -0500 Subject: [PATCH 5/9] 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 317e905..ec67cc7 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -5307,6 +5307,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()) @@ -5318,6 +5324,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()) -- 1.7.9.5