Refines the text selection detection in readInput function.

This change is for enabling the display update while inputting text via the input method.