[LyX/master] Amend 782f6eae00c30
Juergen Spitzmueller
spitz at lyx.org
Wed Dec 20 06:25:27 UTC 2023
commit 378397a6c687695503b1e6bf9f7d1e6419099b07
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Wed Dec 20 08:49:54 2023 +0100
Amend 782f6eae00c30
Rows should only be removed in ct mode if they have been added
in ct mode by the same author (otherwise mark them deleted)
---
src/insets/InsetTabular.cpp | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index c22d078..27201d2 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -808,7 +808,13 @@ void Tabular::deleteRow(row_type const row, bool const force)
if (nrows() == 1)
return;
- bool const ct = force ? false : buffer().params().track_changes;
+ // If we are in change tracking mode, and the row is not marked
+ // as inserted by the same author, we do not delete it, but mark
+ // it deleted.
+ bool const track_deletion = force ? false
+ : buffer().params().track_changes
+ && (!row_info[row].change.inserted()
+ || !row_info[row].change.currentAuthor());
for (col_type c = 0; c < ncols(); ++c) {
// Care about multirow cells
@@ -818,7 +824,7 @@ void Tabular::deleteRow(row_type const row, bool const force)
cell_info[row + 1][c] = cell_info[row][c];
}
}
- if (ct && !row_info[row].change.inserted())
+ if (track_deletion)
row_info[row].change.setDeleted();
else {
row_info.erase(row_info.begin() + row);
@@ -970,7 +976,13 @@ void Tabular::deleteColumn(col_type const col, bool const force)
if (ncols() == 1)
return;
- bool const ct = force ? false : buffer().params().track_changes;
+ // If we are in change tracking mode, and the column is not marked
+ // as inserted by the same author, we do not delete it, but mark
+ // it deleted.
+ bool const track_deletion = force ? false
+ : buffer().params().track_changes
+ && (!column_info[col].change.inserted()
+ || !column_info[col].change.currentAuthor());
for (row_type r = 0; r < nrows(); ++r) {
// Care about multicolumn cells
@@ -979,10 +991,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 || column_info[col].change.inserted())
+ if (!track_deletion)
cell_info[r].erase(cell_info[r].begin() + col);
}
- if (ct && !column_info[col].change.inserted())
+ if (track_deletion)
column_info[col].change.setDeleted();
else
column_info.erase(column_info.begin() + col);
More information about the lyx-cvs
mailing list