Skip to content

Commit f3a7cac

Browse files
committed
Handle options within blink state manager
1 parent 0d2a58c commit f3a7cac

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

addons/addon-webgl/src/WebglRenderer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ export class WebglRenderer extends Disposable implements IRenderer {
109109
this._register(_optionsService.onOptionChange(() => this._handleOptionsChanged()));
110110
this._textBlinkStateManager = this._register(new TextBlinkStateManager(
111111
() => this._requestRedrawViewport(),
112-
this._coreBrowserService
112+
this._coreBrowserService,
113+
this._optionsService
113114
));
114-
this._textBlinkStateManager.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration);
115115

116116
this._deviceMaxTextureSize = this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE);
117117

@@ -257,7 +257,6 @@ export class WebglRenderer extends Disposable implements IRenderer {
257257
this._updateDimensions();
258258
this._refreshCharAtlas();
259259
this._updateCursorBlink();
260-
this._textBlinkStateManager.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration);
261260
}
262261

263262
/**

src/browser/renderer/dom/DomRenderer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ export class DomRenderer extends Disposable implements IRenderer {
100100
this._register(toDisposable(() => this._cursorBlinkStateManager.dispose()));
101101
this._textBlinkStateManager = this._register(new TextBlinkStateManager(
102102
() => this._onRequestRedraw.fire({ start: 0, end: this._bufferService.rows - 1 }),
103-
this._coreBrowserService
103+
this._coreBrowserService,
104+
this._optionsService
104105
));
105-
this._textBlinkStateManager.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration);
106106

107107
this._register(toDisposable(() => {
108108
this._element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);
@@ -447,7 +447,6 @@ export class DomRenderer extends Disposable implements IRenderer {
447447
this._optionsService.rawOptions.fontWeightBold
448448
);
449449
this._setDefaultSpacing();
450-
this._textBlinkStateManager.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration);
451450
}
452451

453452
public clear(): void {

src/browser/renderer/shared/TextBlinkStateManager.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { ICoreBrowserService } from 'browser/services/Services';
77
import { Disposable, toDisposable } from 'common/Lifecycle';
8+
import { IOptionsService } from 'common/services/Services';
89

910
export class TextBlinkStateManager extends Disposable {
1011
private _intervalDuration: number = 0;
@@ -13,9 +14,14 @@ export class TextBlinkStateManager extends Disposable {
1314

1415
constructor(
1516
private readonly _renderCallback: () => void,
16-
private readonly _coreBrowserService: ICoreBrowserService
17+
private readonly _coreBrowserService: ICoreBrowserService,
18+
private readonly _optionsService: IOptionsService
1719
) {
1820
super();
21+
this._register(this._optionsService.onSpecificOptionChange('blinkIntervalDuration', duration => {
22+
this.setIntervalDuration(duration);
23+
}));
24+
this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration);
1925
this._register(toDisposable(() => this._clearInterval()));
2026
}
2127

0 commit comments

Comments
 (0)