Skip to content

Commit

Permalink
Merge pull request #3257 from xtermjs/Tyriar-patch-1
Browse files Browse the repository at this point in the history
Change warning to one per session not terminal
  • Loading branch information
Tyriar authored Mar 19, 2021
2 parents 6edfa51 + 5c5ca4e commit c4ed61e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/common/CoreTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ import { IBufferSet } from 'common/buffer/Types';
import { InputHandler } from 'common/InputHandler';
import { WriteBuffer } from 'common/input/WriteBuffer';

// Only trigger this warning a single time per session
let hasWriteSyncWarnHappened: boolean = false;

export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
protected readonly _instantiationService: IInstantiationService;
protected readonly _bufferService: IBufferService;
Expand Down Expand Up @@ -135,13 +138,12 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
* @deprecated Unreliable, will be removed soon.
*/
public writeSync(data: string | Uint8Array): void {
if (this._logService.logLevel <= LogLevelEnum.WARN && !this._hasBeenWarnedOnce) {
if (this._logService.logLevel <= LogLevelEnum.WARN && !hasWriteSyncWarnHappened) {
this._logService.warn('writeSync is unreliable and will be removed soon.');
this._hasBeenWarnedOnce = true;
hasWriteSyncWarnHappened = true;
}
this._writeBuffer.writeSync(data);
}
private _hasBeenWarnedOnce = false;

public resize(x: number, y: number): void {
if (isNaN(x) || isNaN(y)) {
Expand Down

0 comments on commit c4ed61e

Please sign in to comment.