mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-18 10:30:01 +00:00
Stop local echo when remote echo is on
This commit is contained in:
parent
77b74ad659
commit
9a82c4c5c0
@ -66,6 +66,7 @@ export class TelnetSession extends BaseSession {
|
|||||||
private lastWidth = 0
|
private lastWidth = 0
|
||||||
private lastHeight = 0
|
private lastHeight = 0
|
||||||
private requestedOptions = new Set<number>()
|
private requestedOptions = new Set<number>()
|
||||||
|
private telnetRemoteEcho = false
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
injector: Injector,
|
injector: Injector,
|
||||||
@ -159,7 +160,7 @@ export class TelnetSession extends BaseSession {
|
|||||||
data = data.slice(3)
|
data = data.slice(3)
|
||||||
this.logger.debug('<', commandName || command, optionName || option)
|
this.logger.debug('<', commandName || command, optionName || option)
|
||||||
|
|
||||||
if (command === TelnetCommands.WILL || command === TelnetCommands.WONT) {
|
if (command === TelnetCommands.WILL || command === TelnetCommands.WONT || command === TelnetCommands.DONT) {
|
||||||
if (this.requestedOptions.has(option)) {
|
if (this.requestedOptions.has(option)) {
|
||||||
this.requestedOptions.delete(option)
|
this.requestedOptions.delete(option)
|
||||||
continue
|
continue
|
||||||
@ -172,6 +173,11 @@ export class TelnetSession extends BaseSession {
|
|||||||
TelnetOptions.ECHO,
|
TelnetOptions.ECHO,
|
||||||
].includes(option)) {
|
].includes(option)) {
|
||||||
this.emitTelnet(TelnetCommands.DO, option)
|
this.emitTelnet(TelnetCommands.DO, option)
|
||||||
|
if (option === TelnetOptions.ECHO && this.streamProcessor.forceEcho) {
|
||||||
|
this.telnetRemoteEcho = true;
|
||||||
|
this.streamProcessor.forceEcho = false;
|
||||||
|
this.requestOption(TelnetCommands.WONT, option);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.logger.debug('(!) Unhandled option')
|
this.logger.debug('(!) Unhandled option')
|
||||||
this.emitTelnet(TelnetCommands.DONT, option)
|
this.emitTelnet(TelnetCommands.DONT, option)
|
||||||
@ -182,8 +188,13 @@ export class TelnetSession extends BaseSession {
|
|||||||
this.emitTelnet(TelnetCommands.WILL, option)
|
this.emitTelnet(TelnetCommands.WILL, option)
|
||||||
this.emitSize()
|
this.emitSize()
|
||||||
} else if (option === TelnetOptions.ECHO) {
|
} else if (option === TelnetOptions.ECHO) {
|
||||||
|
if (this.telnetRemoteEcho) {
|
||||||
|
this.streamProcessor.forceEcho = false;
|
||||||
|
this.emitTelnet(TelnetCommands.WONT, option)
|
||||||
|
} else {
|
||||||
this.streamProcessor.forceEcho = true
|
this.streamProcessor.forceEcho = true
|
||||||
this.emitTelnet(TelnetCommands.WILL, option)
|
this.emitTelnet(TelnetCommands.WILL, option)
|
||||||
|
}
|
||||||
} else if (option === TelnetOptions.TERMINAL_TYPE) {
|
} else if (option === TelnetOptions.TERMINAL_TYPE) {
|
||||||
this.emitTelnet(TelnetCommands.WILL, option)
|
this.emitTelnet(TelnetCommands.WILL, option)
|
||||||
} else {
|
} else {
|
||||||
@ -197,7 +208,16 @@ export class TelnetSession extends BaseSession {
|
|||||||
this.emitTelnet(TelnetCommands.WONT, option)
|
this.emitTelnet(TelnetCommands.WONT, option)
|
||||||
} else {
|
} else {
|
||||||
this.logger.debug('(!) Unhandled option')
|
this.logger.debug('(!) Unhandled option')
|
||||||
this.emitTelnet(TelnetCommands.WILL, option)
|
this.emitTelnet(TelnetCommands.WONT, option)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (command === TelnetCommands.WONT) {
|
||||||
|
if (option === TelnetOptions.ECHO) {
|
||||||
|
this.telnetRemoteEcho = false;
|
||||||
|
this.emitTelnet(TelnetCommands.DONT, option)
|
||||||
|
} else {
|
||||||
|
this.logger.debug('(!) Unhandled option')
|
||||||
|
this.emitTelnet(TelnetCommands.DONT, option)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (command === TelnetCommands.SUBOPTION) {
|
if (command === TelnetCommands.SUBOPTION) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user