diff --git a/src/sql/workbench/services/notebook/browser/models/notebookModel.ts b/src/sql/workbench/services/notebook/browser/models/notebookModel.ts index 55c6b9e152..e55c49b398 100644 --- a/src/sql/workbench/services/notebook/browser/models/notebookModel.ts +++ b/src/sql/workbench/services/notebook/browser/models/notebookModel.ts @@ -636,6 +636,10 @@ export class NotebookModel extends Disposable implements INotebookModel { partialSource = source.slice(tailRange.startLineNumber - 1, tailRange.startLineNumber)[0].slice(tailRange.startColumn - 1); tailSource.splice(0, 1, partialSource); } + //Remove the trailing empty line after the cursor + if (tailSource[0] === '\r\n' || tailSource[0] === '\n') { + tailSource.splice(0, 1); + } tailCell.source = tailSource; tailCellIndex = newCellIndex + 1; this.insertCell(tailCell, tailCellIndex);