Skip to content

Commit

Permalink
notebook: Select the Last Cell when deleting selected last cell (#13715)
Browse files Browse the repository at this point in the history
* notebook: Select the Last Cell when deleting selected cell with index larger than avaialable cells

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>

* better length check

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>

---------

Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
  • Loading branch information
jonah-iden authored May 16, 2024
1 parent dacc1ae commit 44b4f27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/notebook/src/browser/view-model/notebook-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export class NotebookModel implements Saveable, Disposable {

// if selected cell is affected update it because it can potentially have been replaced
if (cell === this.selectedCell) {
this.setSelectedCell(this.cells[cellIndex]);
this.setSelectedCell(this.cells[Math.min(cellIndex, this.cells.length - 1)]);
}
}

Expand Down

0 comments on commit 44b4f27

Please sign in to comment.