@xterm/xterm 5.6.0-beta.70 → 5.6.0-beta.71

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": "5.6.0-beta.70",
4
+ "version": "5.6.0-beta.71",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -107,5 +107,5 @@
107
107
  "ws": "^8.2.3",
108
108
  "xterm-benchmark": "^0.3.1"
109
109
  },
110
- "commit": "41e8ae395937011d6bf6c7cb618b851791aed395"
110
+ "commit": "5018a07f3c2e243740a9f2cdd55fe8d8ba9f5f63"
111
111
  }
@@ -82,7 +82,7 @@ export class ThemeService extends Disposable implements IThemeService {
82
82
  const colors = this._colors;
83
83
  colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND);
84
84
  colors.background = parseColor(theme.background, DEFAULT_BACKGROUND);
85
- colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR);
85
+ colors.cursor = color.blend(colors.background, parseColor(theme.cursor, DEFAULT_CURSOR));
86
86
  colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT);
87
87
  colors.selectionBackgroundTransparent = parseColor(theme.selectionBackground, DEFAULT_SELECTION);
88
88
  colors.selectionBackgroundOpaque = color.blend(colors.background, colors.selectionBackgroundTransparent);
@@ -315,7 +315,8 @@ export class Buffer implements IBuffer {
315
315
  }
316
316
 
317
317
  private _reflowLarger(newCols: number, newRows: number): void {
318
- const toRemove: number[] = reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(DEFAULT_ATTR_DATA));
318
+ const reflowCursorLine = this._optionsService.rawOptions.reflowCursorLine;
319
+ const toRemove: number[] = reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(DEFAULT_ATTR_DATA), reflowCursorLine);
319
320
  if (toRemove.length > 0) {
320
321
  const newLayoutResult = reflowLargerCreateNewLayout(this.lines, toRemove);
321
322
  reflowLargerApplyNewLayout(this.lines, newLayoutResult.layout);
@@ -347,6 +348,7 @@ export class Buffer implements IBuffer {
347
348
  }
348
349
 
349
350
  private _reflowSmaller(newCols: number, newRows: number): void {
351
+ const reflowCursorLine = this._optionsService.rawOptions.reflowCursorLine;
350
352
  const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);
351
353
  // Gather all BufferLines that need to be inserted into the Buffer here so that they can be
352
354
  // batched up and only committed once
@@ -367,11 +369,13 @@ export class Buffer implements IBuffer {
367
369
  wrappedLines.unshift(nextLine);
368
370
  }
369
371
 
370
- // If these lines contain the cursor don't touch them, the program will handle fixing up
371
- // wrapped lines with the cursor
372
- const absoluteY = this.ybase + this.y;
373
- if (absoluteY >= y && absoluteY < y + wrappedLines.length) {
374
- continue;
372
+ if (!reflowCursorLine) {
373
+ // If these lines contain the cursor don't touch them, the program will handle fixing up
374
+ // wrapped lines with the cursor
375
+ const absoluteY = this.ybase + this.y;
376
+ if (absoluteY >= y && absoluteY < y + wrappedLines.length) {
377
+ continue;
378
+ }
375
379
  }
376
380
 
377
381
  const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength();
@@ -20,8 +20,9 @@ export interface INewLayoutResult {
20
20
  * @param newCols The columns after resize.
21
21
  * @param bufferAbsoluteY The absolute y position of the cursor (baseY + cursorY).
22
22
  * @param nullCell The cell data to use when filling in empty cells.
23
+ * @param reflowCursorLine Whether to reflow the line containing the cursor.
23
24
  */
24
- export function reflowLargerGetLinesToRemove(lines: CircularList<IBufferLine>, oldCols: number, newCols: number, bufferAbsoluteY: number, nullCell: ICellData): number[] {
25
+ export function reflowLargerGetLinesToRemove(lines: CircularList<IBufferLine>, oldCols: number, newCols: number, bufferAbsoluteY: number, nullCell: ICellData, reflowCursorLine: boolean): number[] {
25
26
  // Gather all BufferLines that need to be removed from the Buffer here so that they can be
26
27
  // batched up and only committed once
27
28
  const toRemove: number[] = [];
@@ -41,11 +42,13 @@ export function reflowLargerGetLinesToRemove(lines: CircularList<IBufferLine>, o
41
42
  nextLine = lines.get(++i) as BufferLine;
42
43
  }
43
44
 
44
- // If these lines contain the cursor don't touch them, the program will handle fixing up wrapped
45
- // lines with the cursor
46
- if (bufferAbsoluteY >= y && bufferAbsoluteY < i) {
47
- y += wrappedLines.length - 1;
48
- continue;
45
+ if (!reflowCursorLine) {
46
+ // If these lines contain the cursor don't touch them, the program will handle fixing up
47
+ // wrapped lines with the cursor
48
+ if (bufferAbsoluteY >= y && bufferAbsoluteY < i) {
49
+ y += wrappedLines.length - 1;
50
+ continue;
51
+ }
49
52
  }
50
53
 
51
54
  // Copy buffer data to new locations
@@ -44,6 +44,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
44
44
  allowTransparency: false,
45
45
  tabStopWidth: 8,
46
46
  theme: {},
47
+ reflowCursorLine: false,
47
48
  rescaleOverlappingGlyphs: false,
48
49
  rightClickSelectsWord: isMac,
49
50
  windowOptions: {},
@@ -237,6 +237,7 @@ export interface ITerminalOptions {
237
237
  macOptionIsMeta?: boolean;
238
238
  macOptionClickForcesSelection?: boolean;
239
239
  minimumContrastRatio?: number;
240
+ reflowCursorLine?: boolean;
240
241
  rescaleOverlappingGlyphs?: boolean;
241
242
  rightClickSelectsWord?: boolean;
242
243
  rows?: number;
@@ -213,6 +213,13 @@ declare module '@xterm/xterm' {
213
213
  */
214
214
  minimumContrastRatio?: number;
215
215
 
216
+ /**
217
+ * Whether to reflow the line containing the cursor when the terminal is
218
+ * resized. Defaults to false, because shells usually handle this
219
+ * themselves.
220
+ */
221
+ reflowCursorLine?: boolean;
222
+
216
223
  /**
217
224
  * Whether to rescale glyphs horizontally that are a single cell wide but
218
225
  * have glyphs that would overlap following cell(s). This typically happens