configurator: drain tty input after each step() title
gum's TUI startup queries the terminal (e.g., cursor position via
CSI 6n) and doesn't always read the reply. The reply bytes
("^[[13;1R") then surface visibly next to the next step title.
A one-time drain at script start (in .automated_script.sh) catches
the boot-time replies but not the gum-per-call ones, since the
artifact came back at every new step().
Add a small _drain_tty helper and call it from step() after the
title gum-style invocation so any pending DSR replies are consumed
before the next prompt runs.
This commit is contained in:
1 file changed
+8
@@ -13,10 +13,18 @@ abort() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Drain any pending terminal-reply bytes (cursor position reports, etc.)
|
||||||
|
# that gum's TUI startup sends but doesn't always consume. Without this,
|
||||||
|
# bytes like ^[[13;1R show up next to step titles.
|
||||||
|
_drain_tty() {
|
||||||
|
while IFS= read -r -t 0 -n 1024 _drain </dev/tty 2>/dev/null; do :; done
|
||||||
|
}
|
||||||
|
|
||||||
step() {
|
step() {
|
||||||
clear_logo
|
clear_logo
|
||||||
echo
|
echo
|
||||||
gum style "$1"
|
gum style "$1"
|
||||||
|
_drain_tty
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user