Spreadsheet: Fix unintended copies

This commit is contained in:
Chris Hennes
2023-02-26 09:14:41 -06:00
committed by Chris Hennes
parent c8a35d85fe
commit 42a910982d
2 changed files with 4 additions and 4 deletions

View File

@@ -1234,7 +1234,7 @@ void Sheet::insertColumns(int col, int count)
void Sheet::removeColumns(int col, int count)
{
// Remove aliases, if defined
for (auto address : cells.getColumns(col, count)) {
for (const auto &address : cells.getColumns(col, count)) {
auto cell = getCell(address);
std::string aliasStr;
if (cell && cell->getAlias(aliasStr))
@@ -1270,7 +1270,7 @@ void Sheet::insertRows(int row, int count)
void Sheet::removeRows(int row, int count)
{
// Remove aliases, if defined
for (auto address : cells.getRows(row, count)) {
for (const auto &address : cells.getRows(row, count)) {
auto cell = getCell(address);
std::string aliasStr;
if (cell && cell->getAlias(aliasStr))
@@ -1573,7 +1573,7 @@ void Sheet::setCopyOrCutRanges(const std::vector<App::Range> &ranges, bool copy)
std::set<Range> rangeSet(copyCutRanges.begin(), copyCutRanges.end());
copyCutRanges = ranges;
rangeSet.insert(copyCutRanges.begin(), copyCutRanges.end());
for(auto range : rangeSet)
for(const auto &range : rangeSet)
rangeUpdated(range);
hasCopyRange = copy;
}

View File

@@ -709,7 +709,7 @@ void SheetTableView::pasteClipboard()
return;
if(!copy) {
for(auto range : ranges) {
for(auto &range : ranges) {
do {
sheet->clear(*range);
} while (range.next());