Commit e64adab
committed
Fix menu requiring double input on Alpine (#38)
read -rsn1 in press_any_key consumes only 1 byte. Multi-byte keys
(arrows, function keys) send escape sequences (e.g. \033[A) — the
remaining bytes leak into stdin and get picked up by the next
read_choice, matching no menu option and causing a silent redraw.
Fix: drain leftover bytes after every read -rsn1 and defensively
at the top of read_choice before accepting user input.1 parent 408b9c8 commit e64adab
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
285 | 287 | | |
286 | 288 | | |
287 | 289 | | |
| |||
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
| 312 | + | |
| 313 | + | |
310 | 314 | | |
311 | 315 | | |
312 | 316 | | |
| |||
4516 | 4520 | | |
4517 | 4521 | | |
4518 | 4522 | | |
| 4523 | + | |
4519 | 4524 | | |
4520 | 4525 | | |
4521 | 4526 | | |
| |||
0 commit comments