Skip to content

Commit

Permalink
Fix #4087 Regain editor focus after view in tab
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Dec 9, 2023
1 parent 322e495 commit 2e632f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/preview/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,20 @@ async function viewInCustomEditor(pdfFile: string): Promise<void> {
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)
Expand Down

0 comments on commit 2e632f3

Please sign in to comment.