use only the search string when going into text mode

Don't attempt to append characters from the event.

fixes #1544
append the '.' when switching to text mode while typing
check the event type to prevent an exception
include NSFlagsChanged when checking for key events
Merge pull request #1545 from skurfer/i1544

prevent a crash with Command Window in Text Mode