Skip to content

Commit

Permalink
also set bg color
Browse files Browse the repository at this point in the history
  • Loading branch information
mofux committed Jul 11, 2017
1 parent 0d570cd commit 804051e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ export class Renderer {
for (let i = 0; i < width; i++) {
// TODO: Could data be a more specific type?
let data: any = line[i][0];
let cursorFg;
let cursorData;
const ch = line[i][1];
const ch_width: any = line[i][2];
if (!ch_width) {
continue;
}

if (i === x) {
cursorFg = (data >> 9) & 0x1ff;
cursorData = [data & 0x1ff, (data >> 9) & 0x1ff];
data = -1;
}

Expand All @@ -203,11 +203,16 @@ export class Renderer {
currentElement = this._spanElementObjectPool.acquire();

if (data === -1) {
let cursorBg = cursorData[0];
let cursorFg = cursorData[1];
currentElement.classList.add('reverse-video');
currentElement.classList.add('terminal-cursor');
if (cursorFg < 256) {
if (cursorFg >= 0 && cursorFg < 256) {
currentElement.classList.add(`xterm-color-${cursorFg}`);
}
if (cursorBg >= 0 && cursorBg < 256) {
currentElement.classList.add(`xterm-bg-color-${cursorBg}`);
}
} else {
let bg = data & 0x1ff;
let fg = (data >> 9) & 0x1ff;
Expand Down

0 comments on commit 804051e

Please sign in to comment.