@xterm/xterm 6.1.0-beta.244 → 6.1.0-beta.246

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xterm/xterm",
3
3
  "description": "Full xterm terminal, in your browser",
4
- "version": "6.1.0-beta.244",
4
+ "version": "6.1.0-beta.246",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -111,5 +111,5 @@
111
111
  "ws": "^8.2.3",
112
112
  "xterm-benchmark": "^0.3.1"
113
113
  },
114
- "commit": "2c3fad39af916260c5349b08d385fab048a32482"
114
+ "commit": "be339bf796235821abf884ff4c6384e82058c6de"
115
115
  }
@@ -6,4 +6,4 @@
6
6
  /**
7
7
  * The xterm.js version. This is updated by the publish script from package.json.
8
8
  */
9
- export const XTERM_VERSION = '6.1.0-beta.244';
9
+ export const XTERM_VERSION = '6.1.0-beta.246';
@@ -8,6 +8,7 @@ import { AttributeData } from 'common/buffer/AttributeData';
8
8
  import { CellData } from 'common/buffer/CellData';
9
9
  import { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from 'common/buffer/Constants';
10
10
  import { stringFromCodePoint } from 'common/input/TextDecoder';
11
+ import { StringBuilder } from 'common/StringBuilder';
11
12
 
12
13
  // Buffer memory layout:
13
14
  //
@@ -41,6 +42,7 @@ export const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());
41
42
  // Work variables to avoid garbage collection
42
43
  let $startIndex = 0;
43
44
  const $workCell = new CellData();
45
+ const $translateToStringBuilder = new StringBuilder();
44
46
 
45
47
  export interface IBufferLineStringCacheEntry {
46
48
  value: string | undefined;
@@ -570,12 +572,12 @@ export class BufferLine implements IBufferLine {
570
572
  if (outColumns) {
571
573
  outColumns.length = 0;
572
574
  }
573
- let result = '';
575
+ $translateToStringBuilder.reset();
574
576
  while (startCol < endCol) {
575
577
  const content = this._data[startCol * Constants.CELL_INDICIES + Cell.CONTENT];
576
578
  const cp = content & Content.CODEPOINT_MASK;
577
579
  const chars = (content & Content.IS_COMBINED_MASK) ? this._combined[startCol] : (cp) ? stringFromCodePoint(cp) : WHITESPACE_CELL_CHAR;
578
- result += chars;
580
+ $translateToStringBuilder.append(chars);
579
581
  if (outColumns) {
580
582
  for (let i = 0; i < chars.length; ++i) {
581
583
  outColumns.push(startCol);
@@ -586,6 +588,8 @@ export class BufferLine implements IBufferLine {
586
588
  if (outColumns) {
587
589
  outColumns.push(startCol);
588
590
  }
591
+ const result = $translateToStringBuilder.toString();
592
+ $translateToStringBuilder.reset();
589
593
  if (isCanonicalRequest) {
590
594
  const cacheEntry = this._getStringCacheEntry(true)!;
591
595
  cacheEntry.value = result;
@@ -225,12 +225,7 @@ export class DecorationLineCache extends Disposable {
225
225
  if (newLine < 0) {
226
226
  continue;
227
227
  }
228
- const existing = newMap.get(newLine);
229
- if (existing) {
230
- existing.push(...bucket);
231
- } else {
232
- newMap.set(newLine, bucket.slice());
233
- }
228
+ this._mergeLineBucket(newMap, newLine, bucket);
234
229
  }
235
230
  this._decorationsByLine.clear();
236
231
  for (const [line, bucket] of newMap) {
@@ -254,7 +249,9 @@ export class DecorationLineCache extends Disposable {
254
249
  private _mergeLineBucket(newMap: Map<number, IInternalDecoration[]>, line: number, bucket: IInternalDecoration[]): void {
255
250
  const existing = newMap.get(line);
256
251
  if (existing) {
257
- existing.push(...bucket);
252
+ for (let i = 0, len = bucket.length; i < len; i++) {
253
+ existing.push(bucket[i]);
254
+ }
258
255
  } else {
259
256
  newMap.set(line, bucket.slice());
260
257
  }