Fix bug where text is always inserted at the end.

The code appending keypresses to the end of the input is invoked even
if the keypress originated in that input field. This means that input
is always appended instead of inserted where the cursor is. A simple
check to see if the event originated from one of our inputs prevents
this from occurring.