Skip to content

Commit

Permalink
Iterate only through the cells array in grid to set selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiolo committed Oct 15, 2023
1 parent f8bacf7 commit c07c023
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,15 @@ struct Document {

void InitWith(Cell *r, wxString filename, Cell *ics, int xs, int ys) {
rootgrid = r;
if (ics) {
Grid* ipg = ics->parent->grid;
if (ipg) {
foreachcellingrid(c, ipg) {
if (c == ics) {
SetSelect(Selection(ipg, x, y, xs, ys));
goto cellisselected;
}
}
if (Grid *ipg; ics && (ipg = ics->parent->grid)) {
loop(i, ipg->xs * ipg->ys) if (ipg->cells[i] == ics) {
SetSelect(Selection(ipg, i % ipg->xs, i / ipg->xs, xs, ys));
break;
}
} else {
SetSelect(Selection(r->grid, 0, 0, 1, 1));
}
cellisselected:
ChangeFileName(filename, false);
ChangeFileName(filename, false);
}

void UpdateFileName(int page = -1) {
Expand Down

0 comments on commit c07c023

Please sign in to comment.