-
Notifications
You must be signed in to change notification settings - Fork 38.3k
Clear promptInput's value onCommandFinished #287139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a2752ec
2c33701
d604ce4
f936493
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,6 +113,7 @@ export class PromptInputModel extends Disposable implements IPromptInputModel { | |
| onCommandStart: Event<ITerminalCommand>, | ||
| onCommandStartChanged: Event<void>, | ||
| onCommandExecuted: Event<ITerminalCommand>, | ||
| onCommandFinished: Event<ITerminalCommand>, | ||
| @ILogService private readonly _logService: ILogService | ||
| ) { | ||
| super(); | ||
|
|
@@ -127,6 +128,7 @@ export class PromptInputModel extends Disposable implements IPromptInputModel { | |
| this._register(onCommandStart(e => this._handleCommandStart(e as { marker: IMarker }))); | ||
| this._register(onCommandStartChanged(() => this._handleCommandStartChanged())); | ||
| this._register(onCommandExecuted(() => this._handleCommandExecuted())); | ||
| this._register(onCommandFinished(() => this._handleCommandFinished())); | ||
|
|
||
| this._register(this.onDidStartInput(() => this._logCombinedStringIfTrace('PromptInputModel#onDidStartInput'))); | ||
| this._register(this.onDidChangeInput(() => this._logCombinedStringIfTrace('PromptInputModel#onDidChangeInput'))); | ||
|
|
@@ -261,6 +263,13 @@ export class PromptInputModel extends Disposable implements IPromptInputModel { | |
| this._onDidChangeInput.fire(event); | ||
| } | ||
|
|
||
| private _handleCommandFinished() { | ||
| // Clear the prompt input value when command finishes to prepare for the next command | ||
| // This prevents runCommand from detecting leftover text and sending ^C unnecessarily | ||
anthonykim1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this._value = ''; | ||
anthonykim1 marked this conversation as resolved.
Show resolved
Hide resolved
anthonykim1 marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if it will be good idea to fire an empty
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're changing the value, let's fire it to be consistent and see if there are any problems. |
||
| this._onDidChangeInput.fire(this._createStateObject()); | ||
| } | ||
|
|
||
| @throttle(0) | ||
| private _sync() { | ||
| try { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.