- col_type const col1 = tabular.cellColumn(stidx);
- col_type const col2 = tabular.cellColumn(enidx);
- row_type const row1 = tabular.cellRow(stidx);
- row_type const row2 = tabular.cellRow(enidx);
+ col_type col1 = tabular.cellColumn(stidx);
+ col_type col2 = tabular.cellColumn(enidx);
+ row_type row1 = tabular.cellRow(stidx);
+ row_type row2 = tabular.cellRow(enidx);
+ // stidx might be in a later column or row than enidx
+ if (col1 > col2)
+ swap(col1, col2);
+ if (row1 > row2)
+ swap(row1, row2);