Fix finding views with line breaks.

This fixes #265 and #267. It also takes into account the ideas bnickel
stated out in #267.