Stop forciby reselecting the document

Forcibly reselecting the document made using keyboard navigation inconvenient
This commit is contained in:
John 2022-05-05 21:13:18 -05:00
parent 8456f57b84
commit 7c985b3817

View File

@ -121,7 +121,6 @@ function getNumberOfSelectedLines(): void {
(numberOfSelectedLines !== 1) (numberOfSelectedLines !== 1)
? window.showInformationMessage(`${numberOfSelectedLines.toString()} Lines Selected`) ? window.showInformationMessage(`${numberOfSelectedLines.toString()} Lines Selected`)
: window.showInformationMessage(`${numberOfSelectedLines.toString()} Line Selected`); : window.showInformationMessage(`${numberOfSelectedLines.toString()} Line Selected`);
window.showTextDocument(editor.document); // After the selection is made, the editor loses focus. We need to re-focus the editor so typing isn't interrupted
} }
else { else {
window.showErrorMessage('No document currently active'); window.showErrorMessage('No document currently active');
@ -139,7 +138,6 @@ function getLineNumber(): void {
const lineNum: number = fetchLineNumber(editor); const lineNum: number = fetchLineNumber(editor);
window.showInformationMessage(`Line ${lineNum.toString()}`); window.showInformationMessage(`Line ${lineNum.toString()}`);
window.showTextDocument(editor.document); // After the selection is made, the editor loses focus. We need to re-focus the editor so typing isn't interrupted
} }
else { else {
window.showErrorMessage('No document currently active'); window.showErrorMessage('No document currently active');
@ -172,7 +170,6 @@ function getIndent(): void {
? window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indents`) ? window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indents`)
: window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indent`); : window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indent`);
} }
window.showTextDocument(editor.document); // After the selection is made, the editor loses focus. We need to re-focus the editor so typing isn't interrupted
} }
else { else {
window.showErrorMessage('No document currently active'); window.showErrorMessage('No document currently active');
@ -201,7 +198,6 @@ function getLeadingSpaces(): void {
? window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces`) ? window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces`)
: window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} space`); : window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} space`);
} }
window.showTextDocument(editor.document); // After the selection is made, the editor loses focus. We need to re-focus the editor so typing isn't interrupted
} }
else { else {
window.showErrorMessage('No document currently active'); window.showErrorMessage('No document currently active');
@ -239,7 +235,8 @@ function selectLeadingWhitespace(): void {
else { else {
window.showErrorMessage(`Line ${lineNum.toString()}: No leading spaces to select!`); // No whitespace to select window.showErrorMessage(`Line ${lineNum.toString()}: No leading spaces to select!`); // No whitespace to select
} }
window.showTextDocument(editor.document); // After the selection is made, the editor loses focus. We need to re-focus the editor so typing isn't interrupted // Move the cursor to the new selection
window.showTextDocument(editor.document);
} }
else { else {
window.showErrorMessage('No document currently active'); // No active document window.showErrorMessage('No document currently active'); // No active document