More rigourous definition of mode
This prevents interactive mode frames and logs being sent during raw mode.
This commit is contained in:
parent
70d3f45f60
commit
b2f1315c11
|
@ -151,6 +151,7 @@ export default class extends utils.mixins(CommonMixin, TTYCommandsMixin) {
|
|||
|
||||
_acknowledgeNewTab(native_tab_object) {
|
||||
let tab = this._applyUpdates(native_tab_object);
|
||||
tab._is_raw_text_mode = this._is_raw_text_mode;
|
||||
tab.postDOMLoadInit(this.terminal, this.dimensions);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default class extends utils.mixins(CommonMixin, TabCommandsMixin) {
|
|||
// The maximum amount of times to try to recover a tab that won't connect
|
||||
this._max_number_of_tab_recovery_reloads = 3;
|
||||
// Type of raw text mode; HTML or plain
|
||||
this.raw_text_mode = '';
|
||||
this.raw_text_mode_type = '';
|
||||
}
|
||||
|
||||
postDOMLoadInit(terminal, dimensions) {
|
||||
|
@ -24,8 +24,16 @@ export default class extends utils.mixins(CommonMixin, TabCommandsMixin) {
|
|||
this.channel = channel;
|
||||
this._sendTTYDimensions();
|
||||
this._listenForMessages();
|
||||
let mode = 'interactive';
|
||||
if (this.raw_text_mode !== '') { mode = this.raw_text_mode }
|
||||
this._calculateMode();
|
||||
}
|
||||
|
||||
_calculateMode() {
|
||||
let mode;
|
||||
if (!this._is_raw_text_mode) {
|
||||
mode = 'interactive';
|
||||
} else {
|
||||
mode = this.raw_text_mode_type;
|
||||
}
|
||||
this.channel.postMessage(`/mode,${mode}`);
|
||||
}
|
||||
|
||||
|
@ -110,7 +118,12 @@ export default class extends utils.mixins(CommonMixin, TabCommandsMixin) {
|
|||
}
|
||||
|
||||
setMode(mode) {
|
||||
this.raw_text_mode = mode;
|
||||
this.raw_text_mode_type = mode;
|
||||
// Send it here, in case there is a race condition with the postCommsInit() not knowing
|
||||
// the mode.
|
||||
if (this._is_raw_text_mode) {
|
||||
this.channel.postMessage(`/mode,${mode}`);
|
||||
}
|
||||
}
|
||||
|
||||
_listenForMessages() {
|
||||
|
|
|
@ -44,7 +44,7 @@ export default class extends utils.mixins(CommonMixin, CommandsMixin) {
|
|||
}
|
||||
|
||||
sendAllBigFrames() {
|
||||
if (this._is_raw_mode) { return }
|
||||
if (!this._is_interactive_mode) { return }
|
||||
if (!this.dimensions.tty.width) {
|
||||
this.log("Not sending big frames without TTY data")
|
||||
return
|
||||
|
@ -66,6 +66,7 @@ export default class extends utils.mixins(CommonMixin, CommandsMixin) {
|
|||
}
|
||||
|
||||
sendSmallPixelFrame() {
|
||||
if (!this._is_interactive_mode) { return }
|
||||
if (!this.dimensions.tty.width) {
|
||||
this.log("Not sending small frames without TTY data")
|
||||
return;
|
||||
|
@ -76,6 +77,7 @@ export default class extends utils.mixins(CommonMixin, CommandsMixin) {
|
|||
}
|
||||
|
||||
sendSmallTextFrame() {
|
||||
if (!this._is_interactive_mode) { return }
|
||||
if (!this.dimensions.tty.width) {
|
||||
this.log("Not sending small frames without TTY data")
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue