fix artificial cursor color.

This commit is contained in:
Christopher Jeffrey 2015-03-16 23:53:31 -07:00
parent 5dc3af1937
commit 13890ec409
2 changed files with 8 additions and 1 deletions

View File

@ -326,6 +326,9 @@ function Screen(options) {
this.cursorShape = options.cursorShape || 'block';
this.cursorBlink = options.cursorBlink || false;
this.cursorColor = options.cursorColor || null;
if (this.cursorColor) {
this.cursorColor = colors.convert(this.cursorColor);
}
this.cursorState = 1;
this._cursorHidden = true;
var hideCursor = this.program.hideCursor;
@ -1020,16 +1023,20 @@ Screen.prototype.draw = function(start, end) {
&& x === this.program.x
&& y === this.program.y) {
if (this.cursorShape === 'line') {
data &= ~(0x1ff << 9);
data |= 7 << 9;
ch = '\u2502';
} else if (this.cursorShape === 'underline') {
data &= ~(0x1ff << 9);
data |= 7 << 9;
data |= 2 << 18;
} else if (this.cursorShape === 'block') {
data &= ~(0x1ff << 9);
data |= 7 << 9;
data |= 8 << 18;
}
if (this.cursorColor != null) {
data &= ~(0x1ff << 9);
data |= this.cursorColor << 9;
}
}

View File

@ -8,7 +8,7 @@ screen = blessed.screen({
cursorShape: 'line',
cursorBlink: true,
cursorColor: null
//cursorColor: 'red'
});
screen.append(blessed.text({