Merge pull request #236729 from microsoft/tyriuar/160325

Suppress exit warning after ctrl+d
pull/236735/head
Daniel Imms 2024-12-20 10:01:10 -08:00 committed by GitHub
commit e5f9272019
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View File

@ -1095,6 +1095,11 @@ export interface IXtermTerminal extends IDisposable {
*/
readonly isGpuAccelerated: boolean;
/**
* The last `onData` input event fired by {@link RawXtermTerminal.onData}.
*/
readonly lastInputEvent: string | undefined;
/**
* Attached the terminal to the given element
* @param container Container the terminal will be rendered in

View File

@ -1598,7 +1598,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
} else {
if (exitMessage) {
const failedDuringLaunch = this._processManager.processState === ProcessState.KilledDuringLaunch;
if (failedDuringLaunch || this._terminalConfigurationService.config.showExitAlert) {
if (failedDuringLaunch || (this._terminalConfigurationService.config.showExitAlert && this.xterm?.lastInputEvent !== /*Ctrl+D*/'\x04')) {
// Always show launch failures
this._notificationService.notify({
message: exitMessage,

View File

@ -96,6 +96,8 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
private static _suggestedRendererType: 'dom' | undefined = undefined;
private _attached?: { container: HTMLElement; options: IXtermAttachToElementOptions };
private _isPhysicalMouseWheel = MouseWheelClassifier.INSTANCE.isPhysicalMouseWheel();
private _lastInputEvent: string | undefined;
get lastInputEvent(): string | undefined { return this._lastInputEvent; }
// Always on addons
private _markNavigationAddon: MarkNavigationAddon;
@ -256,6 +258,7 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
this._anyFocusedTerminalHasSelection.set(this.raw.hasSelection());
}
}));
this._register(this.raw.onData(e => this._lastInputEvent = e));
// Load addons
this._updateUnicodeVersion();