File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1647,6 +1647,14 @@ show_totp_until_esc() {
16471647 local last_totp_time=0 last_totp=" "
16481648 printf " \n" # reserve a line for updates
16491649
1650+ # Clear any pending keystrokes before we start displaying the TOTP.
1651+ # In particular, a stray Escape key from the previous passphrase
1652+ # prompt could be sitting in the input buffer and would cause the
1653+ # function to immediately return on the next iteration, confusing
1654+ # the user when they try to hit Esc again. Drain stdin until it's
1655+ # empty.
1656+ while IFS= read -r -t 0 -n 1 junk; do : ; done
1657+
16501658 # Poll frequently (200ms) for responsiveness, but only refresh the
16511659 # displayed timestamp/TOTP when the displayed second changes. Cache
16521660 # the TOTP for a short interval to avoid repeated unseal calls.
You can’t perform that action at this time.
0 commit comments