mirror of
https://github.com/tsl0922/ttyd.git
synced 2025-12-31 16:04:24 +01:00
html: recreate sentry object on zmodem reset
This commit is contained in:
@@ -18,17 +18,12 @@ export class ZmodemAddon extends Component<Props, State> implements ITerminalAdd
|
||||
private terminal: Terminal | undefined;
|
||||
private keyDispose: IDisposable | undefined;
|
||||
private sentry: Zmodem.Sentry;
|
||||
private session: Zmodem.Session | undefined;
|
||||
private session: Zmodem.Session;
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.sentry = new Zmodem.Sentry({
|
||||
to_terminal: (octets: ArrayBuffer) => this.zmodemWrite(octets),
|
||||
sender: (octets: ArrayLike<number>) => this.zmodemSend(octets),
|
||||
on_retract: () => this.zmodemReset(),
|
||||
on_detect: (detection: Zmodem.Detection) => this.zmodemDetect(detection),
|
||||
});
|
||||
this.zmodemInit();
|
||||
}
|
||||
|
||||
render(_, { modal }: State) {
|
||||
@@ -63,6 +58,17 @@ export class ZmodemAddon extends Component<Props, State> implements ITerminalAdd
|
||||
this.zmodemReset();
|
||||
}
|
||||
|
||||
@bind
|
||||
private zmodemInit() {
|
||||
this.session = null;
|
||||
this.sentry = new Zmodem.Sentry({
|
||||
to_terminal: (octets: ArrayBuffer) => this.zmodemWrite(octets),
|
||||
sender: (octets: ArrayLike<number>) => this.zmodemSend(octets),
|
||||
on_retract: () => this.zmodemReset(),
|
||||
on_detect: (detection: Zmodem.Detection) => this.zmodemDetect(detection),
|
||||
});
|
||||
}
|
||||
|
||||
@bind
|
||||
private zmodemReset() {
|
||||
this.terminal.setOption('disableStdin', false);
|
||||
@@ -71,6 +77,7 @@ export class ZmodemAddon extends Component<Props, State> implements ITerminalAdd
|
||||
this.keyDispose.dispose();
|
||||
this.keyDispose = null;
|
||||
}
|
||||
this.zmodemInit();
|
||||
|
||||
this.terminal.focus();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user