Fix Find in Files bugs

Fixes main issue described in issue #2503.

Also, fixed escaping of query string for displaying in HTML.