fn: sgnd_menu_read_choice
Purpose
Read menu input directly from /dev/tty and normalize navigation/control keys.
Behavior
- Q/q return EXIT only when SGND_MENU_Q_EXIT is enabled (default).
- When SGND_MENU_Q_EXIT is disabled, Q/q are returned as literal choices and Ctrl+Q is ignored.
- R/r return RESET.
- Ctrl+R returns REDRAW.
- Esc returns ESC unless followed by a recognized arrow sequence.
- Left/right arrows return < and >.
- Single-character controls are returned immediately.
- Multi-digit numeric selections are completed with Enter.
Arguments
$1— OUTPUT_VAR - Variable receiving the normalized choice.
Returns
0 on input; non-zero when /dev/tty cannot be read.
Usage
sgnd_menu_read_choice choice
