The input line is not actually preserved. When a new line of output is printed, the input line is replaced by output and printed to the next line. The result is that it looks like it never went away, but it really did. (Echoing is specifically disabled and stdin is made non-blocking.)