Commit 0eb72d1
Fix arrow key navigation in prompts on Windows (#4501)
## Summary
- Fixes #4481 — arrow keys stopped working for yes/no and enum selection
during `databricks bundle init` on Windows
- Root cause: PR #4301 started passing `io.NopCloser(os.Stdin)` as
explicit `Stdin` to `promptui`, which bypasses `chzyer/readline`'s
Windows-specific `RawReader`. That reader uses `ReadConsoleInputW` to
translate arrow key virtual key codes (`VK_UP`/`VK_DOWN`) into readline
navigation — without it, arrow keys are silently ignored on Windows.
- Fix: introduce `promptStdin()` helper that returns `nil` when `c.in`
is `os.Stdin` (letting readline use its platform default) and wraps
custom readers for test scenarios.
## Test plan
- [x] `go test ./libs/cmdio/...` passes
- [x] `go test ./libs/template/...` passes
- [x] Verify on Windows that arrow keys work in `databricks bundle init`
selection prompts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent e15b8f1 commit 0eb72d1
2 files changed
+19
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
92 | | - | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
140 | 154 | | |
141 | 155 | | |
142 | 156 | | |
| |||
148 | 162 | | |
149 | 163 | | |
150 | 164 | | |
151 | | - | |
| 165 | + | |
152 | 166 | | |
153 | 167 | | |
154 | 168 | | |
155 | 169 | | |
156 | 170 | | |
157 | 171 | | |
158 | | - | |
| 172 | + | |
159 | 173 | | |
160 | 174 | | |
161 | 175 | | |
| |||
0 commit comments