Fix issues where escape codes could end up on startup in the input prompt (#7267)

This commit is contained in:
Jacob Richman
2025-09-05 17:18:51 -07:00
committed by GitHub
parent dfd622e096
commit 81904005fc
5 changed files with 167 additions and 50 deletions

View File

@@ -115,7 +115,10 @@ export function KeypressProvider({
}
};
setRawMode(true);
const wasRaw = stdin.isRaw;
if (wasRaw === false) {
setRawMode(true);
}
const keypressStream = new PassThrough();
let usePassthrough = false;
@@ -677,7 +680,9 @@ export function KeypressProvider({
rl.close();
// Restore the terminal to its original state.
setRawMode(false);
if (wasRaw === false) {
setRawMode(false);
}
if (backslashTimeout) {
clearTimeout(backslashTimeout);