Added support for mouse shadowing while typing. Previously it only shadowed while moving the text cursor around with the arrow keys.
refactoring and improvements.