diff --git a/src/pseudoTerminal.ts b/src/pseudoTerminal.ts index d7dbf70..05575fd 100644 --- a/src/pseudoTerminal.ts +++ b/src/pseudoTerminal.ts @@ -18,6 +18,8 @@ export interface SSHPseudoTerminal extends vscode.Pseudoterminal { client: Client; /** Could be undefined if it only gets created during psy.open() instead of beforehand */ channel?: ClientChannel; + /** Either set by the code calling createTerminal, otherwise "calculated" and hopefully found */ + terminal?: vscode.Terminal; } export interface TerminalOptions { @@ -34,6 +36,7 @@ export async function createTerminal(options: TerminalOptions): Promise(); const onDidClose = new vscode.EventEmitter(); const onDidOpen = new vscode.EventEmitter(); + let terminal: vscode.Terminal | undefined; // Won't actually open the remote terminal until pseudo.open(dims) is called const pseudo: SSHPseudoTerminal = { status: 'opening', @@ -52,7 +55,6 @@ export async function createTerminal(options: TerminalOptions): Promise 'pty' in t.creationOptions && t.creationOptions.pty === pseudo); + }, + set terminal(term: vscode.Terminal | undefined) { + terminal = term; + }, setDimensions(dims) { pseudo.channel?.setWindow(dims.rows, dims.columns, HEIGHT, WIDTH); },