Merge pull request #2868 from Tyriar/2595_selection_colors

Refresh model colors after changing theme
This commit is contained in:
Daniel Imms
2020-04-25 06:42:01 -07:00
committed by GitHub
5 changed files with 14 additions and 8 deletions
@@ -213,14 +213,14 @@ export class GlyphRenderer {
// a_cellpos only changes on resize // a_cellpos only changes on resize
} }
public updateSelection(model: IRenderModel, columnSelectMode: boolean): void { public updateSelection(model: IRenderModel): void {
const terminal = this._terminal; const terminal = this._terminal;
this._vertices.selectionAttributes = slice(this._vertices.attributes, 0); this._vertices.selectionAttributes = slice(this._vertices.attributes, 0);
const bg = (this._colors.selectionOpaque.rgba >>> 8) | Attributes.CM_RGB; const bg = (this._colors.selectionOpaque.rgba >>> 8) | Attributes.CM_RGB;
if (columnSelectMode) { if (model.selection.columnSelectMode) {
const startCol = model.selection.startCol; const startCol = model.selection.startCol;
const width = model.selection.endCol - startCol; const width = model.selection.endCol - startCol;
const height = model.selection.viewportCappedEndRow - model.selection.viewportCappedStartRow + 1; const height = model.selection.viewportCappedEndRow - model.selection.viewportCappedStartRow + 1;
@@ -171,7 +171,7 @@ export class RectangleRenderer {
); );
} }
public updateSelection(model: ISelectionRenderModel, columnSelectMode: boolean): void { public updateSelection(model: ISelectionRenderModel): void {
const terminal = this._terminal; const terminal = this._terminal;
if (!model.hasSelection) { if (!model.hasSelection) {
@@ -179,7 +179,7 @@ export class RectangleRenderer {
return; return;
} }
if (columnSelectMode) { if (model.columnSelectMode) {
const startCol = model.startCol; const startCol = model.startCol;
const width = model.endCol - startCol; const width = model.endCol - startCol;
const height = model.viewportCappedEndRow - model.viewportCappedStartRow + 1; const height = model.viewportCappedEndRow - model.viewportCappedStartRow + 1;
@@ -22,6 +22,7 @@ export class RenderModel implements IRenderModel {
this.lineLengths = new Uint32Array(0); this.lineLengths = new Uint32Array(0);
this.selection = { this.selection = {
hasSelection: false, hasSelection: false,
columnSelectMode: false,
viewportStartRow: 0, viewportStartRow: 0,
viewportEndRow: 0, viewportEndRow: 0,
viewportCappedStartRow: 0, viewportCappedStartRow: 0,
+1
View File
@@ -56,6 +56,7 @@ export interface IRenderModel {
export interface ISelectionRenderModel { export interface ISelectionRenderModel {
hasSelection: boolean; hasSelection: boolean;
columnSelectMode: boolean;
viewportStartRow: number; viewportStartRow: number;
viewportEndRow: number; viewportEndRow: number;
viewportCappedStartRow: number; viewportCappedStartRow: number;
@@ -117,6 +117,9 @@ export class WebglRenderer extends Disposable implements IRenderer {
this._refreshCharAtlas(); this._refreshCharAtlas();
this._rectangleRenderer.updateSelection(this._model.selection);
this._glyphRenderer.updateSelection(this._model);
// Force a full refresh // Force a full refresh
this._model.clear(); this._model.clear();
} }
@@ -173,10 +176,10 @@ export class WebglRenderer extends Disposable implements IRenderer {
public onSelectionChanged(start: [number, number], end: [number, number], columnSelectMode: boolean): void { public onSelectionChanged(start: [number, number], end: [number, number], columnSelectMode: boolean): void {
this._renderLayers.forEach(l => l.onSelectionChanged(this._terminal, start, end, columnSelectMode)); this._renderLayers.forEach(l => l.onSelectionChanged(this._terminal, start, end, columnSelectMode));
this._updateSelectionModel(start, end); this._updateSelectionModel(start, end, columnSelectMode);
this._rectangleRenderer.updateSelection(this._model.selection, columnSelectMode); this._rectangleRenderer.updateSelection(this._model.selection);
this._glyphRenderer.updateSelection(this._model, columnSelectMode); this._glyphRenderer.updateSelection(this._model);
this._onRequestRedraw.fire({ start: 0, end: this._terminal.rows - 1 }); this._onRequestRedraw.fire({ start: 0, end: this._terminal.rows - 1 });
} }
@@ -292,7 +295,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
this._rectangleRenderer.updateBackgrounds(this._model); this._rectangleRenderer.updateBackgrounds(this._model);
} }
private _updateSelectionModel(start: [number, number], end: [number, number]): void { private _updateSelectionModel(start: [number, number], end: [number, number], columnSelectMode: boolean): void {
const terminal = this._terminal; const terminal = this._terminal;
// Selection does not exist // Selection does not exist
@@ -314,6 +317,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
} }
this._model.selection.hasSelection = true; this._model.selection.hasSelection = true;
this._model.selection.columnSelectMode = columnSelectMode;
this._model.selection.viewportStartRow = viewportStartRow; this._model.selection.viewportStartRow = viewportStartRow;
this._model.selection.viewportEndRow = viewportEndRow; this._model.selection.viewportEndRow = viewportEndRow;
this._model.selection.viewportCappedStartRow = viewportCappedStartRow; this._model.selection.viewportCappedStartRow = viewportCappedStartRow;