Skip to content

Commit

Permalink
added update topic for doublelines
Browse files Browse the repository at this point in the history
  • Loading branch information
MightyPork committed Nov 12, 2017
1 parent d489e99 commit 0893b0a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
15 changes: 10 additions & 5 deletions js/term/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
30 changes: 21 additions & 9 deletions js/term/screen_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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() })

Expand Down

0 comments on commit 0893b0a

Please sign in to comment.