---------- Forwarded message ---------- From: Zahari Dimitrov <zaha...@gmail.com> Date: Thu, Jan 5, 2012 at 6:49 PM Subject: Patch: Better behavior when deleting rows and columns from tables To: lyx-devel@lists.lyx.org
Hello, This small enhancement is my first contribution to Lyx. I hope it is useful for somebody. With this patch if the last column (or row) is deleted, the new last column takes the same right borders. So, for a default table for example, there is no need to select the column and create the right borders again.
Index: InsetTabular.cpp =================================================================== --- InsetTabular.cpp (revision 40572) +++ InsetTabular.cpp (working copy) @@ -5305,6 +5305,11 @@ 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()) @@ -5316,6 +5321,11 @@ 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))); + } for (col_type c = sel_col_start; c <= sel_col_end; ++c) tabular.deleteColumn(sel_col_start); if (sel_col_start >= tabular.ncols())