@xterm/xterm 5.6.0-beta.49 → 5.6.0-beta.50

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.49",
4
+ "version": "5.6.0-beta.50",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -549,11 +549,11 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
549
549
  }
550
550
  this.register(this.optionsService.onSpecificOptionChange('screenReaderMode', e => this._handleScreenReaderModeOptionChange(e)));
551
551
 
552
- if (this.options.overviewRulerWidth) {
552
+ if (this.options.overviewRuler.width) {
553
553
  this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));
554
554
  }
555
- this.optionsService.onSpecificOptionChange('overviewRulerWidth', value => {
556
- if (!this._overviewRulerRenderer && value && this._viewportElement && this.screenElement) {
555
+ this.optionsService.onSpecificOptionChange('overviewRuler', value => {
556
+ if (!this._overviewRulerRenderer && value.width && this._viewportElement && this.screenElement) {
557
557
  this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));
558
558
  }
559
559
  });
@@ -60,7 +60,7 @@ export class Viewport extends Disposable {
60
60
  this.register(this._optionsService.onMultipleOptionChange([
61
61
  'scrollSensitivity',
62
62
  'fastScrollSensitivity',
63
- 'overviewRulerWidth'
63
+ 'overviewRuler'
64
64
  ], () => this._scrollableElement.updateOptions(this._getChangeOptions())));
65
65
  // Don't handle mouse wheel if wheel events are supported by the current mouse prototcol
66
66
  this.register(coreMouseService.onProtocolChange(type => {
@@ -121,7 +121,7 @@ export class Viewport extends Disposable {
121
121
  return {
122
122
  mouseWheelScrollSensitivity: this._optionsService.rawOptions.scrollSensitivity,
123
123
  fastScrollSensitivity: this._optionsService.rawOptions.fastScrollSensitivity,
124
- verticalScrollbarSize: this._optionsService.rawOptions.overviewRulerWidth || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH
124
+ verticalScrollbarSize: this._optionsService.rawOptions.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH
125
125
  };
126
126
  }
127
127
 
@@ -38,7 +38,7 @@ export class OverviewRulerRenderer extends Disposable {
38
38
  private readonly _ctx: CanvasRenderingContext2D;
39
39
  private readonly _colorZoneStore: IColorZoneStore = new ColorZoneStore();
40
40
  private get _width(): number {
41
- return this._optionsService.options.overviewRulerWidth || 0;
41
+ return this._optionsService.options.overviewRuler?.width || 0;
42
42
  }
43
43
  private _animationFrame: number | undefined;
44
44
 
@@ -95,7 +95,7 @@ export class OverviewRulerRenderer extends Disposable {
95
95
  }));
96
96
 
97
97
  this.register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));
98
- this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true)));
98
+ this.register(this._optionsService.onSpecificOptionChange('overviewRuler', () => this._queueRefresh(true)));
99
99
  this.register(this._themeService.onChangeColors(() => this._queueRefresh()));
100
100
  this._queueRefresh(true);
101
101
  }
@@ -176,6 +176,12 @@ export class OverviewRulerRenderer extends Disposable {
176
176
  private _renderRulerOutline(): void {
177
177
  this._ctx.fillStyle = this._themeService.colors.overviewRulerBorder.css;
178
178
  this._ctx.fillRect(0, 0, Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);
179
+ if (this._optionsService.rawOptions.overviewRuler.showTopBorder) {
180
+ this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, 0, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, Constants.OVERVIEW_RULER_BORDER_WIDTH);
181
+ }
182
+ if (this._optionsService.rawOptions.overviewRuler.showBottomBorder) {
183
+ this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);
184
+ }
179
185
  }
180
186
 
181
187
  private _renderColorZone(zone: IColorZone): void {
@@ -54,7 +54,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
54
54
  convertEol: false,
55
55
  termName: 'xterm',
56
56
  cancelEvents: false,
57
- overviewRulerWidth: 0
57
+ overviewRuler: {}
58
58
  };
59
59
 
60
60
  const FONT_WEIGHT_OPTIONS: Extract<FontWeight, string>[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];
@@ -3,7 +3,7 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty } from '@xterm/xterm';
6
+ import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, type IOverviewRulerOptions } from '@xterm/xterm';
7
7
  import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
8
8
  import { IBuffer, IBufferSet } from 'common/buffer/Types';
9
9
  import { createDecorator } from 'common/services/ServiceRegistry';
@@ -251,7 +251,7 @@ export interface ITerminalOptions {
251
251
  windowsPty?: IWindowsPty;
252
252
  windowOptions?: IWindowOptions;
253
253
  wordSeparator?: string;
254
- overviewRulerWidth?: number;
254
+ overviewRuler?: IOverviewRulerOptions;
255
255
 
256
256
  [key: string]: any;
257
257
  cancelEvents: boolean;
@@ -327,10 +327,10 @@ declare module '@xterm/xterm' {
327
327
  windowOptions?: IWindowOptions;
328
328
 
329
329
  /**
330
- * The width, in pixels, of the canvas for the overview ruler. The overview
331
- * ruler will be hidden when not set.
330
+ * Controls the visibility and style of the overview ruler which visualizes
331
+ * decorations underneath the scroll bar.
332
332
  */
333
- overviewRulerWidth?: number;
333
+ overviewRuler?: IOverviewRulerOptions;
334
334
  }
335
335
 
336
336
  /**
@@ -387,9 +387,8 @@ declare module '@xterm/xterm' {
387
387
  scrollbarSliderActiveBackground?: string;
388
388
  /**
389
389
  * The border color of the overview ruler. This visually separates the
390
- * terminal from the scroll bar when
391
- * {@link ITerminalOptions.overviewRulerWidth overviewRulerWidth} is set.
392
- * When this is not set it defaults to black (`#000000`).
390
+ * terminal from the scroll bar when {@link IOverviewRulerOptions.width} is
391
+ * set. When this is not set it defaults to black (`#000000`).
393
392
  */
394
393
  overviewRulerBorder?: string;
395
394
  /** ANSI black (eg. `\x1b[30m`) */
@@ -617,8 +616,8 @@ declare module '@xterm/xterm' {
617
616
 
618
617
  /**
619
618
  * When defined, renders the decoration in the overview ruler to the right
620
- * of the terminal. {@link ITerminalOptions.overviewRulerWidth} must be set
621
- * in order to see the overview ruler.
619
+ * of the terminal. {@link IOverviewRulerOptions.width} must be set in order
620
+ * to see the overview ruler.
622
621
  * @param color The color of the decoration.
623
622
  * @param position The position of the decoration.
624
623
  */
@@ -641,6 +640,28 @@ declare module '@xterm/xterm' {
641
640
  tooMuchOutput: string;
642
641
  }
643
642
 
643
+ export interface IOverviewRulerOptions {
644
+ /**
645
+ * When defined, renders decorations in the overview ruler to the right of
646
+ * the terminal. This must be set in order to see the overview ruler.
647
+ * @param color The color of the decoration.
648
+ * @param position The position of the decoration.
649
+ */
650
+ width?: number;
651
+
652
+ /**
653
+ * Whether to show the top border of the overview ruler, which uses the
654
+ * {@link ITheme.overviewRulerBorder} color.
655
+ */
656
+ showTopBorder?: boolean;
657
+
658
+ /**
659
+ * Whether to show the bottom border of the overview ruler, which uses the
660
+ * {@link ITheme.overviewRulerBorder} color.
661
+ */
662
+ showBottomBorder?: boolean;
663
+ }
664
+
644
665
  /**
645
666
  * Enable various window manipulation and report features
646
667
  * (`CSI Ps ; Ps ; Ps t`).