From 7e001ee50c9494a2d423049d287440427825e143 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 5 May 2022 22:06:24 -0500 Subject: [PATCH] Only return cursor to editor when selection succeeds --- src/commands/text.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/text.ts b/src/commands/text.ts index d314152..b0b8b15 100755 --- a/src/commands/text.ts +++ b/src/commands/text.ts @@ -231,12 +231,13 @@ function selectLeadingWhitespace(): void { (numSpaces !== 1) ? window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces selected`) : window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} space selected`); + + // Move the cursor to the new selection + window.showTextDocument(editor.document); } else { window.showErrorMessage(`Line ${lineNum.toString()}: No leading spaces to select!`); // No whitespace to select } - // Move the cursor to the new selection - window.showTextDocument(editor.document); } else { window.showErrorMessage('No document currently active'); // No active document