Skip to content

Commit

Permalink
<C-u> to clear watch mode pattern prompt #11296
Browse files Browse the repository at this point in the history
  • Loading branch information
madhur1846 committed Apr 27, 2021
1 parent b3f9e4a commit 184d795
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/jest-watcher/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const KEYS = {
BACKSPACE: Buffer.from(isWindows ? '08' : '7f', 'hex').toString(),
CONTROL_C: '\u0003',
CONTROL_D: '\u0004',
CONTROL_U: '\u0015',
ENTER: '\r',
ESCAPE: '\u001b',
};
6 changes: 6 additions & 0 deletions packages/jest-watcher/src/lib/Prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ export default class Prompt {
this._onSuccess(this._selection || this._value);
this.abort();
break;
case KEYS.CONTROL_U:
this._value = "";
this._offset = -1;
this._selection = null;
this._onChange();
break;
case KEYS.ESCAPE:
this._entering = false;
this._onCancel(this._value);
Expand Down

0 comments on commit 184d795

Please sign in to comment.