Fix selection color to set correct mode

This commit is contained in:
Daniel
2019-11-09 22:48:28 -08:00
parent e15476704c
commit 9dd2ccb1ad
2 changed files with 10 additions and 9 deletions
@@ -10,7 +10,7 @@ import { INDICIES_PER_CELL } from './WebglRenderer';
import { COMBINED_CHAR_BIT_MASK } from './RenderModel';
import { fill } from 'common/TypedArrayUtils';
import { slice } from './TypedArray';
import { NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';
import { NULL_CELL_CODE, WHITESPACE_CELL_CODE, Attributes } from 'common/buffer/Constants';
import { getLuminance } from './ColorUtils';
import { Terminal, IBufferLine } from 'xterm';
import { IColorSet } from 'browser/Types';
@@ -223,8 +223,8 @@ export class GlyphRenderer {
// TODO: Make fg and bg configurable, currently since the buffer doesn't
// support truecolor the char atlas cannot store it.
const lumi = getLuminance(this._colors.background);
const fg = lumi > 0.5 ? 7 : 0;
const bg = lumi > 0.5 ? 0 : 7;
const fg = (lumi > 0.5 ? 7 : 0) | Attributes.CM_P16;
const bg = (lumi > 0.5 ? 0 : 7) | Attributes.CM_P16;
if (columnSelectMode) {
const startCol = model.selection.startCol;
@@ -271,15 +271,15 @@ export class WebglRenderer extends Disposable implements IRenderer {
this._model.lineLengths[y] = x + 1;
}
// Nothing has changed, no updates needed
if (this._model.cells[i] === code && this._model.cells[i + 1] === attr) {
continue;
}
// Resolve bg and fg and cache in the model
// Resolve bg and fg
let bg = this._workCell.bg;
let fg = this._workCell.fg;
// Nothing has changed, no updates needed
if (this._model.cells[i] === code && this._model.cells[i + 2] === bg && this._model.cells[i + 3] === fg) {
continue;
}
// If inverse flag is on, the foreground should become the background.
if (this._workCell.isInverse()) {
const temp = bg;
@@ -303,6 +303,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
code = code | COMBINED_CHAR_BIT_MASK;
}
// Cache the results in the model
this._model.cells[i ] = code;
// TODO: Remove attr from model
this._model.cells[i + 1] = attr;