[LyX/master] Fix tracking of table row/column deletion with added material (#12984)

Juergen Spitzmueller spitz at lyx.org
Tue Dec 19 14:20:41 UTC 2023


commit 782f6eae00c306e4bae84b90cff7371613529d66
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Tue Dec 19 16:45:16 2023 +0100

    Fix tracking of table row/column deletion with added material (#12984)
---
 src/insets/InsetTabular.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 6572dfe..c22d078 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -818,7 +818,7 @@ void Tabular::deleteRow(row_type const row, bool const force)
 				cell_info[row + 1][c] = cell_info[row][c];
 		}
 	}
-	if (ct)
+	if (ct && !row_info[row].change.inserted())
 		row_info[row].change.setDeleted();
 	else {
 		row_info.erase(row_info.begin() + row);
@@ -979,10 +979,10 @@ void Tabular::deleteColumn(col_type const col, bool const force)
 		    cell_info[r][col + 1].multicolumn == CELL_PART_OF_MULTICOLUMN) {
 				cell_info[r][col + 1] = cell_info[r][col]; 
 		}
-		if (!ct)
+		if (!ct || column_info[col].change.inserted())
 			cell_info[r].erase(cell_info[r].begin() + col);
 	}
-	if (ct)
+	if (ct && !column_info[col].change.inserted())
 		column_info[col].change.setDeleted();
 	else
 		column_info.erase(column_info.begin() + col);
@@ -6746,7 +6746,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
 		}
 
 		for (row_type r = sel_row_start; r <= sel_row_end; ++r)
-			tabular.deleteRow(sel_row_start);
+			tabular.deleteRow(r);
 		if (sel_row_start >= tabular.nrows())
 			--sel_row_start;
 		cur.idx() = tabular.cellIndex(sel_row_start, column);
@@ -6769,7 +6769,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
 		}
 
 		for (col_type c = sel_col_start; c <= sel_col_end; ++c)
-			tabular.deleteColumn(sel_col_start);
+			tabular.deleteColumn(c);
 		if (sel_col_start >= tabular.ncols())
 			--sel_col_start;
 		cur.idx() = tabular.cellIndex(row, sel_col_start);


More information about the lyx-cvs mailing list