added backdrop url topic W

pull/1/head
Ondřej Hruška 7 years ago
parent 75fb70c083
commit 608a393b63
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 38
      js/term/screen_parser.js

@ -35,6 +35,7 @@ const TOPIC_BUTTONS = 'B'
const TOPIC_CURSOR = 'C' const TOPIC_CURSOR = 'C'
const TOPIC_INTERNAL = 'D' const TOPIC_INTERNAL = 'D'
const TOPIC_BELL = '!' const TOPIC_BELL = '!'
const TOPIC_BACKDROP = 'W'
const OPT_CURSOR_VISIBLE = (1 << 0) const OPT_CURSOR_VISIBLE = (1 << 0)
const OPT_DEBUGBAR = (1 << 1) const OPT_DEBUGBAR = (1 << 1)
@ -84,6 +85,19 @@ module.exports = class ScreenParser {
const topics = du(strArray[ci++]) const topics = du(strArray[ci++])
// this.screen.cursor.hanging = !!(attributes & (1 << 1)) // this.screen.cursor.hanging = !!(attributes & (1 << 1))
let collectOneTerminatedString = () => {
// TODO optimize this
text = ''
while (ci < strArray.length) {
let c = strArray[ci++]
if (c !== '\x01') {
text += c
} else {
break
}
}
}
while (ci < strArray.length) { while (ci < strArray.length) {
const topic = strArray[ci++] const topic = strArray[ci++]
@ -179,17 +193,7 @@ module.exports = class ScreenParser {
this.screen.renderer.scheduleDraw('cursor-moved') this.screen.renderer.scheduleDraw('cursor-moved')
} else if (topic === TOPIC_TITLE) { } else if (topic === TOPIC_TITLE) {
// TODO optimize this text = collectOneTerminatedString()
text = ''
while (ci < strArray.length) {
let c = strArray[ci++]
if (c !== '\x01') {
text += c
} else {
break
}
}
qs('#screen-title').textContent = text qs('#screen-title').textContent = text
if (text.length === 0) text = 'Terminal' if (text.length === 0) text = 'Terminal'
qs('title').textContent = `${text} :: ESPTerm` qs('title').textContent = `${text} :: ESPTerm`
@ -199,16 +203,16 @@ module.exports = class ScreenParser {
let labels = [] let labels = []
for (let j = 0; j < count; j++) { for (let j = 0; j < count; j++) {
text = '' text = collectOneTerminatedString()
while (ci < strArray.length) {
let c = strArray[ci++]
if (c === '\x01') break
text += c
}
labels.push(text) labels.push(text)
} }
this.screen.emit('button-labels', labels) this.screen.emit('button-labels', labels)
} else if (topic === TOPIC_BACKDROP) {
text = collectOneTerminatedString()
this.screen.backgroundImage = text
} else if (topic === TOPIC_BELL) { } else if (topic === TOPIC_BELL) {
this.screen.beep() this.screen.beep()

Loading…
Cancel
Save