diff options
author | Florrie <towerofnix@gmail.com> | 2017-12-09 23:45:05 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2017-12-09 23:45:05 -0400 |
commit | 1de4c9c10530eb6efbb9af06d5a2cf881ccd85af (patch) | |
tree | c0c19b47806efa83d5fe8853bd782f580bb0e217 | |
parent | 21d1a6724eadcf91a616beb06ad763e7e5fafcdc (diff) |
Make ansi interpreter work with selective control sequences
-rw-r--r-- | util/ansi.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/util/ansi.js b/util/ansi.js index 564fdf8..f3f4cbe 100644 --- a/util/ansi.js +++ b/util/ansi.js @@ -129,6 +129,7 @@ const ansi = { const chars = new Array(scrRows * scrCols).fill(blank) + let showCursor = true let cursorRow = 1 let cursorCol = 1 const attributes = [] @@ -144,6 +145,12 @@ const ansi = { charI++ + // Selective control sequences (look them up) - we can just skip the + // question mark. + if (text[charI] === '?') { + charI++ + } + const args = [] let val = '' while (isDigit(text[charI])) { @@ -165,6 +172,13 @@ const ansi = { cursorCol = args[1] } + // SM - Set Mode + if (text[charI] === 'h') { + if (args[0] === '25') { + showCursor = true + } + } + // ED - Erase Display (clearScreen) if (text[charI] === 'J') { // ESC[2J - erase whole display @@ -190,6 +204,13 @@ const ansi = { } } + // RM - Reset Mode + if (text[charI] === 'l') { + if (args[0] === '25') { + showCursor = false + } + } + // SGR - Select Graphic Rendition if (text[charI] === 'm') { for (let arg of args) { |