summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/markmulti.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/sc/source/core/data/markmulti.cxx b/sc/source/core/data/markmulti.cxx
index a4a66933dba6..644dfad21f6c 100644
--- a/sc/source/core/data/markmulti.cxx
+++ b/sc/source/core/data/markmulti.cxx
@@ -277,10 +277,10 @@ void ScMultiSel::Set( ScRangeList const & rList )
auto & rMarkEntries = aMarkEntriesPerCol[nCol];
int nEntries = rMarkEntries.size();
if (nEntries > 1 && nStartRow >= rMarkEntries[nEntries-2].nRow+1
- && nStartRow <= rMarkEntries[nEntries-1].nRow)
+ && nStartRow <= rMarkEntries[nEntries-1].nRow+1)
{
- // overlaps previous range
- rMarkEntries.back().nRow = nEndRow;
+ // overlaps or directly adjacent previous range
+ rMarkEntries.back().nRow = std::max(nEndRow, rMarkEntries.back().nRow);
}
else
{
@@ -298,7 +298,10 @@ void ScMultiSel::Set( ScRangeList const & rList )
aMultiSelContainer.resize(nMaxCol+1);
for (SCCOL nCol = 0; nCol<=nMaxCol; ++nCol)
if (!aMarkEntriesPerCol[nCol].empty())
+ {
aMultiSelContainer[nCol].Set( aMarkEntriesPerCol[nCol] );
+ aMarkEntriesPerCol[nCol].clear(); // reduce peak memory usage
+ }
}
bool ScMultiSel::IsRowMarked( SCROW nRow ) const