diff --git a/src/prompts/searchable-multi-select.ts b/src/prompts/searchable-multi-select.ts index e011e487a..a0ca0a846 100644 --- a/src/prompts/searchable-multi-select.ts +++ b/src/prompts/searchable-multi-select.ts @@ -203,6 +203,17 @@ async function createSearchableMultiSelect(): Promise< * - Tab to confirm selections */ export async function searchableMultiSelect(config: Config): Promise { + // Fix: Ensure stdin is in the correct state BEFORE creating the prompt + // This fixes the issue where arrow keys don't work until Enter is pressed first. + // The root cause is that welcome-screen's waitForEnter() pauses stdin before this prompt starts. + const stdin = process.stdin; + if (stdin.isTTY) { + if (!stdin.isRaw) { + stdin.setRawMode(true); + } + stdin.resume(); + } + const prompt = await createSearchableMultiSelect(); return prompt(config); } diff --git a/src/ui/welcome-screen.ts b/src/ui/welcome-screen.ts index 5ed26b6a1..998a0becb 100644 --- a/src/ui/welcome-screen.ts +++ b/src/ui/welcome-screen.ts @@ -97,8 +97,8 @@ function waitForEnter(): Promise { // Enter key or Ctrl+C if (char === '\r' || char === '\n' || char === '\u0003') { stdin.removeListener('data', onData); - stdin.setRawMode(wasRaw); - stdin.pause(); + // Don't restore raw mode or pause stdin here - let the next prompt handle stdin state + // This fixes the issue where arrow keys don't work in searchableMultiSelect after welcome screen // Handle Ctrl+C if (char === '\u0003') {