From 914ac2b09d1e69fa353bad344205dfd4eade41a0 Mon Sep 17 00:00:00 2001 From: rajeshka Date: Thu, 21 Oct 2021 11:04:31 -0700 Subject: [PATCH] remove trailing line after the cursor (#17431) * remove trailing line after the cursor * Addressed PR --- .../services/notebook/browser/models/notebookModel.ts | 4 ++++ 1 file changed, 4 insertions(+) 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);