Skip to content

Commit e5f9272

Browse files
authored
Merge pull request microsoft#236729 from microsoft/tyriuar/160325
Suppress exit warning after ctrl+d
2 parents 68ebb25 + 1270874 commit e5f9272

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/vs/workbench/contrib/terminal/browser/terminal.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,11 @@ export interface IXtermTerminal extends IDisposable {
10951095
*/
10961096
readonly isGpuAccelerated: boolean;
10971097

1098+
/**
1099+
* The last `onData` input event fired by {@link RawXtermTerminal.onData}.
1100+
*/
1101+
readonly lastInputEvent: string | undefined;
1102+
10981103
/**
10991104
* Attached the terminal to the given element
11001105
* @param container Container the terminal will be rendered in

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
15981598
} else {
15991599
if (exitMessage) {
16001600
const failedDuringLaunch = this._processManager.processState === ProcessState.KilledDuringLaunch;
1601-
if (failedDuringLaunch || this._terminalConfigurationService.config.showExitAlert) {
1601+
if (failedDuringLaunch || (this._terminalConfigurationService.config.showExitAlert && this.xterm?.lastInputEvent !== /*Ctrl+D*/'\x04')) {
16021602
// Always show launch failures
16031603
this._notificationService.notify({
16041604
message: exitMessage,

src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
9696
private static _suggestedRendererType: 'dom' | undefined = undefined;
9797
private _attached?: { container: HTMLElement; options: IXtermAttachToElementOptions };
9898
private _isPhysicalMouseWheel = MouseWheelClassifier.INSTANCE.isPhysicalMouseWheel();
99+
private _lastInputEvent: string | undefined;
100+
get lastInputEvent(): string | undefined { return this._lastInputEvent; }
99101

100102
// Always on addons
101103
private _markNavigationAddon: MarkNavigationAddon;
@@ -256,6 +258,7 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
256258
this._anyFocusedTerminalHasSelection.set(this.raw.hasSelection());
257259
}
258260
}));
261+
this._register(this.raw.onData(e => this._lastInputEvent = e));
259262

260263
// Load addons
261264
this._updateUnicodeVersion();

0 commit comments

Comments
 (0)