1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

Spreadsheet: Store the column index in a Position instead of its name

This will make constructing (and destructing) Positions a lot cheaper
(as it no longer needs to ref() and unref() a String).
Resulted from #5483, but doesn't fix it.
This commit is contained in:
AnotherTest 2021-02-23 17:06:07 +03:30 committed by Andreas Kling
parent 98f08a8bad
commit 6a6f19a72f
7 changed files with 99 additions and 66 deletions

View file

@ -170,18 +170,18 @@ int main(int argc, char* argv[])
bool first = true;
auto cursor = spreadsheet_widget.current_selection_cursor();
if (cursor) {
Spreadsheet::Position position { spreadsheet_widget.current_worksheet().column(cursor->column()), (size_t)cursor->row() };
url_builder.append(position.to_url().to_string());
Spreadsheet::Position position { (size_t)cursor->column(), (size_t)cursor->row() };
url_builder.append(position.to_url(spreadsheet_widget.current_worksheet()).to_string());
url_builder.append('\n');
}
for (auto& cell : cells) {
if (first && !cursor) {
url_builder.append(cell.to_url().to_string());
url_builder.append(cell.to_url(spreadsheet_widget.current_worksheet()).to_string());
url_builder.append('\n');
}
url_builder.append(cell.to_url().to_string());
url_builder.append(cell.to_url(spreadsheet_widget.current_worksheet()).to_string());
url_builder.append('\n');
auto cell_data = spreadsheet_widget.current_worksheet().at(cell);