2 * Copyright (c) 2017 The xterm.js authors. All rights reserved.
6 export class GridCache<T> {
7 public cache: (T | undefined)[][];
13 public resize(width: number, height: number): void {
14 for (let x = 0; x < width; x++) {
15 if (this.cache.length <= x) {
18 for (let y = this.cache[x].length; y < height; y++) {
19 this.cache[x].push(undefined);
21 this.cache[x].length = height;
23 this.cache.length = width;
26 public clear(): void {
27 for (let x = 0; x < this.cache.length; x++) {
28 for (let y = 0; y < this.cache[x].length; y++) {
29 this.cache[x][y] = undefined;