sc/source/core/data/markmulti.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 2e33212b761cbed1b13a00750ecb7fece0d6a047 Author: hasban12138 <1483478...@qq.com> AuthorDate: Thu Apr 28 15:13:39 2022 +0800 Commit: Eike Rathke <er...@redhat.com> CommitDate: Sat May 7 01:30:00 2022 +0200 tdf#148837: fix cell range negative selection In Calc when you select all and then do negative selection, there has a bug. The reason is in ScMultiSel::SetMarkArea that case will make nBeg larger than nEndRow and in MarkAllCols start will be larger than end. So I added a condition in the if clause to make sure that nBeg is not larger than nEndRow. Change-Id: I7f39a588bf928b2885207810534d78481589c2f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133538 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> (cherry picked from commit 2490715c112699487915865f4267a880fe7bc4b3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133861 diff --git a/sc/source/core/data/markmulti.cxx b/sc/source/core/data/markmulti.cxx index c2396821a597..1cf747e8a982 100644 --- a/sc/source/core/data/markmulti.cxx +++ b/sc/source/core/data/markmulti.cxx @@ -216,7 +216,7 @@ void ScMultiSel::SetMarkArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, S nLast = aRowSel.GetMarkEnd( nBeg, false ); } - if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow ) + if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow && nBeg <= nEndRow ) MarkAllCols( nBeg, nEndRow ); else { @@ -227,7 +227,7 @@ void ScMultiSel::SetMarkArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, S if ( nBeg != mrSheetLimits.GetMaxRowCount() ) nLast = aRowSel.GetMarkEnd( nBeg, false ); } - if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow ) + if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow && nBeg <= nEndRow ) MarkAllCols( nBeg, nEndRow ); }