Fixed bug in previous commit.

The trimSearch() function wouldn't allow typing a space at all. This is
now fixed to only trim spaces when the input field is deselected, or the
enter key is pressed.