Skip to content

Commit

Permalink
set xterm-color for cursor element
Browse files Browse the repository at this point in the history
  • Loading branch information
mofux committed Jul 11, 2017
1 parent 5f817e8 commit 5ff50d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +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;
const ch = line[i][1];
const ch_width: any = line[i][2];
if (!ch_width) {
continue;
}

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

Expand All @@ -199,14 +201,15 @@ export class Renderer {
documentFragment.appendChild(currentElement);
}
currentElement = this._spanElementObjectPool.acquire();

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

if (flags & FLAGS.BOLD) {
if (!brokenBold) {
currentElement.classList.add('xterm-bold');
Expand Down

0 comments on commit 5ff50d3

Please sign in to comment.