sc/source/core/tool/chgtrack.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
New commits: commit 805e73b555df277e7fb35825a0c48d244a2691a9 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Sat Mar 5 15:47:28 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Sat Mar 5 18:06:31 2022 +0100 don't bother tracking changes if both cells are empty (tdf#141174) AppendContent() does something only if the cells differ, which can't be the case if they're both empty, so skip unallocated cells. Change-Id: I367801bac30a8ee641b4ce608392124bac6ef47a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131060 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index ab0cd2ae6199..55530e494fb0 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -2689,10 +2689,15 @@ void ScChangeTrack::AppendContentRange( const ScRange& rRange, for ( SCTAB nTab = nTab1; nTab <= nTab2; nTab++ ) { aPos.SetTab( nTab ); - for ( SCCOL nCol = nCol1; nCol <= nCol2; nCol++ ) + // AppendContent() is a no-op if both cells are empty. + SCCOL lastCol = std::max( pRefDoc->ClampToAllocatedColumns( nTab, nCol2 ), + rDoc.ClampToAllocatedColumns( nTab, nCol2 )); + for ( SCCOL nCol = nCol1; nCol <= lastCol; nCol++ ) { aPos.SetCol( nCol ); - for ( SCROW nRow = nRow1; nRow <= nRow2; nRow++ ) + SCROW lastRow = std::max( pRefDoc->GetLastDataRow( nTab, nCol, nCol, nRow2 ), + rDoc.GetLastDataRow( nTab, nCol, nCol, nRow2 )); + for ( SCROW nRow = nRow1; nRow <= lastRow; nRow++ ) { aPos.SetRow( nRow ); AppendContent( aPos, pRefDoc );