drain_input(
read1) ->synced
Drain pending terminal input up to a DA1 sync barrier
Writes a Primary Device Attributes query (CSI c) and reads and discards
all input until the DA1 reply (CSI ? ... c) arrives. Terminals answer
queries in order, so once the reply is seen, every event the terminal
emitted earlier -- e.g. KKBP key releases still in flight after a
disable_kkbp pop -- has been consumed, from both the kernel input queue
and the stdio buffer. Only works in raw mode with echo off: in cooked
mode the read blocks until a newline and the kernel echoes the reply on
screen, so the drain is skipped and returns false unless a custom read1
is supplied. Also returns false if the reply does not arrive within the
retry budget (~500 ms).