From 2e632f3b8c506e6a10cdd06687486b154fc1cd4c Mon Sep 17 00:00:00 2001 From: James Yu Date: Sat, 9 Dec 2023 15:57:22 +0000 Subject: [PATCH] Fix #4087 Regain editor focus after view in tab --- src/preview/viewer.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/preview/viewer.ts b/src/preview/viewer.ts index 52164a5e4..16010a68c 100644 --- a/src/preview/viewer.ts +++ b/src/preview/viewer.ts @@ -162,16 +162,20 @@ async function viewInCustomEditor(pdfFile: string): Promise { if (currentColumn && currentColumn > 1) { showOptions.viewColumn = currentColumn - 1 await vscode.commands.executeCommand('vscode.openWith', pdfUri, 'latex-workshop-pdf-hook', showOptions) + await vscode.commands.executeCommand('workbench.action.focusRightGroup') } else { await vscode.commands.executeCommand('vscode.openWith', pdfUri, 'latex-workshop-pdf-hook', showOptions) if (currentColumn === vscode.ViewColumn.One) { await moveActiveEditor('left', true) + } else { + await vscode.commands.executeCommand('workbench.action.focusRightGroup') } } } else if (editorGroup === 'right') { const currentColumn = vscode.window.activeTextEditor?.viewColumn showOptions.viewColumn = (currentColumn ?? 0) + 1 await vscode.commands.executeCommand('vscode.openWith', pdfUri, 'latex-workshop-pdf-hook', showOptions) + await vscode.commands.executeCommand('workbench.action.focusLeftGroup') } else { await vscode.commands.executeCommand('vscode.openWith', pdfUri, 'latex-workshop-pdf-hook', showOptions) await moveActiveEditor(editorGroup, true)