add resize method

pull/5370/head
filip mertens 1 year ago
parent c0712cc65d
commit b5ceb46aca
  1. 15
      apps/remixdesktop/src/plugins/xtermPlugin.ts

@ -69,7 +69,7 @@ const clientProfile: Profile = {
name: 'xterm', name: 'xterm',
displayName: 'xterm', displayName: 'xterm',
description: 'xterm plugin', description: 'xterm plugin',
methods: ['createTerminal', 'close', 'keystroke', 'getShells'] methods: ['createTerminal', 'close', 'keystroke', 'getShells', 'resize']
} }
class XtermPluginClient extends ElectronBasePluginClient { class XtermPluginClient extends ElectronBasePluginClient {
@ -134,6 +134,19 @@ class XtermPluginClient extends ElectronBasePluginClient {
this.emit('close', pid) this.emit('close', pid)
} }
async resize(pid: number, {cols, rows}: {cols: number; rows: number}) {
if (this.terminals[pid]) {
try {
this.terminals[pid].resize(cols, rows);
} catch (_err) {
const err = _err as {stack: any};
console.error(err.stack);
}
} else {
console.warn('Warning: Attempted to resize a session with no pty');
}
}
async closeAll(): Promise<void> { async closeAll(): Promise<void> {
for (const pid in this.terminals) { for (const pid in this.terminals) {
this.terminals[pid].kill() this.terminals[pid].kill()

Loading…
Cancel
Save