From 0893b0a26886f64c0fa456a4cc69fef0992d7ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 12 Nov 2017 10:20:04 +0100 Subject: [PATCH] added update topic for doublelines --- js/term/screen.js | 15 ++++++++++----- js/term/screen_parser.js | 30 +++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/js/term/screen.js b/js/term/screen.js index 7985eec..ee3e448 100644 --- a/js/term/screen.js +++ b/js/term/screen.js @@ -93,11 +93,11 @@ module.exports = class TermScreen extends EventEmitter { this.screenLines = [] // For testing TODO remove - this.screenLines[0] = 0b001 - this.screenLines[1] = 0b010 - this.screenLines[2] = 0b100 - this.screenLines[3] = 0b011 - this.screenLines[4] = 0b101 + // this.screenLines[0] = 0b001 + // this.screenLines[1] = 0b010 + // this.screenLines[2] = 0b100 + // this.screenLines[3] = 0b011 + // this.screenLines[4] = 0b101 let selecting = false @@ -500,6 +500,11 @@ module.exports = class TermScreen extends EventEmitter { this.emit('opts-update') break + case 'double-lines': + this.screenLines = update.lines + this.renderScreen('double-lines') + break + case 'static-opts': this.layout.window.fontFamily = update.fontStack || null this.layout.window.fontSize = update.fontSize diff --git a/js/term/screen_parser.js b/js/term/screen_parser.js index c3a8546..9773dbc 100644 --- a/js/term/screen_parser.js +++ b/js/term/screen_parser.js @@ -27,15 +27,17 @@ function du (str) { } /* eslint-disable no-multi-spaces */ -const TOPIC_SCREEN_OPTS = 'O' -const TOPIC_STATIC_OPTS = 'P' -const TOPIC_CONTENT = 'S' -const TOPIC_TITLE = 'T' -const TOPIC_BUTTONS = 'B' -const TOPIC_CURSOR = 'C' -const TOPIC_INTERNAL = 'D' -const TOPIC_BELL = '!' -const TOPIC_BACKDROP = 'W' +// mnemonic +const TOPIC_SCREEN_OPTS = 'O' // O-ptions +const TOPIC_STATIC_OPTS = 'P' // P-arams +const TOPIC_CONTENT = 'S' // S-creen +const TOPIC_TITLE = 'T' // T-itle +const TOPIC_BUTTONS = 'B' // B-uttons +const TOPIC_CURSOR = 'C' // C-ursor +const TOPIC_INTERNAL = 'D' // D-ebug +const TOPIC_BELL = '!' // !!! +const TOPIC_BACKDROP = 'W' // W-allpaper +const TOPIC_DOUBLE_LINES = 'H' // H-uge const OPT_CURSOR_VISIBLE = (1 << 0) const OPT_DEBUGBAR = (1 << 1) @@ -188,6 +190,16 @@ module.exports = class ScreenParser { fontSize }) + } else if (topic === TOPIC_DOUBLE_LINES) { + let lines = [] + const count = du(strArray[ci++]) + for (let i = 0; i < count; i++) { + // format: INDEX<<3 | (dbl-h-bot : dbl-h-top : dbl-w) + let n = du(strArray[ci++]) + lines[n >> 3] = n & 0b111 + } + updates.push({ topic: 'double-lines', lines: lines }) + } else if (topic === TOPIC_TITLE) { updates.push({ topic: 'title', title: collectOneTerminatedString() })