@hackerrank/astra-cli 0.1.27 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/repl.js +12 -2
package/package.json
CHANGED
package/src/repl.js
CHANGED
|
@@ -540,6 +540,15 @@ export class Screen {
|
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
+
// Double-ESC (or second ESC while first is latched) immediately clears input
|
|
544
|
+
if (s === "\x1b\x1b" || (this._pendingEsc && s === "\x1b")) {
|
|
545
|
+
this._clearEscLatch();
|
|
546
|
+
if (this.onClearInput) this.onClearInput();
|
|
547
|
+
this.buf = "";
|
|
548
|
+
this.redraw();
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
|
|
543
552
|
// A Tab following a latched ESC -> mode toggle
|
|
544
553
|
if (this._pendingEsc && s === "\t" && this.onToggleMode) {
|
|
545
554
|
this._clearEscLatch();
|
|
@@ -564,7 +573,8 @@ export class Screen {
|
|
|
564
573
|
this._clearEscLatch();
|
|
565
574
|
}
|
|
566
575
|
|
|
567
|
-
// A lone ESC: latch briefly to disambiguate from split escape sequences
|
|
576
|
+
// A lone ESC: latch briefly to disambiguate from split escape sequences.
|
|
577
|
+
// If no other key arrives within 80ms, clear the input buffer.
|
|
568
578
|
if (s === "\x1b") {
|
|
569
579
|
this._pendingEsc = true;
|
|
570
580
|
clearTimeout(this._escTimer);
|
|
@@ -573,7 +583,7 @@ export class Screen {
|
|
|
573
583
|
if (this.onClearInput) this.onClearInput();
|
|
574
584
|
this.buf = "";
|
|
575
585
|
this.redraw();
|
|
576
|
-
},
|
|
586
|
+
}, 80);
|
|
577
587
|
return;
|
|
578
588
|
}
|
|
579
589
|
|