commit 8a17cc01e0fa81e2730ef96887d4bffbb641cfd0
Author: Juergen Spitzmueller <[email protected]>
Date:   Sun Dec 29 14:09:52 2019 +0100

    Implement (basic) ct for tabular-feature delete-row and delete-column
    
    Fixes part of #8469
    
    For a proper fix that works with change-reject as well as with hide
    changes in output, we need to implement
    ct information in tabular's row and column.
---
 src/insets/InsetTabular.cpp |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index d52ba52..d225854 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -745,6 +745,9 @@ void Tabular::deleteRow(row_type const row)
                return;
 
        for (col_type c = 0; c < ncols(); ++c) {
+               // mark track changes
+               if (buffer().params().track_changes)
+                       
cell_info[row][c].inset->setChange(Change(Change::DELETED));
                // Care about multirow cells
                if (row + 1 < nrows() &&
                    cell_info[row][c].multirow == CELL_BEGIN_OF_MULTIROW &&
@@ -752,8 +755,10 @@ void Tabular::deleteRow(row_type const row)
                                cell_info[row + 1][c].multirow = 
CELL_BEGIN_OF_MULTIROW;
                }
        }
-       row_info.erase(row_info.begin() + row);
-       cell_info.erase(cell_info.begin() + row);
+       if (!buffer().params().track_changes) {
+               row_info.erase(row_info.begin() + row);
+               cell_info.erase(cell_info.begin() + row);
+       }
        updateIndexes();
 }
 
@@ -859,15 +864,20 @@ void Tabular::deleteColumn(col_type const col)
                return;
 
        for (row_type r = 0; r < nrows(); ++r) {
+               // mark track changes
+               if (buffer().params().track_changes)
+                       
cell_info[r][col].inset->setChange(Change(Change::DELETED));
                // Care about multicolumn cells
                if (col + 1 < ncols() &&
                    cell_info[r][col].multicolumn == CELL_BEGIN_OF_MULTICOLUMN 
&&
                    cell_info[r][col + 1].multicolumn == 
CELL_PART_OF_MULTICOLUMN) {
                                cell_info[r][col + 1].multicolumn = 
CELL_BEGIN_OF_MULTICOLUMN;
                }
-               cell_info[r].erase(cell_info[r].begin() + col);
+               if (!buffer().params().track_changes)
+                       cell_info[r].erase(cell_info[r].begin() + col);
        }
-       column_info.erase(column_info.begin() + col);
+       if (!buffer().params().track_changes)
+               column_info.erase(column_info.begin() + col);
        updateIndexes();
 }
 
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to