Make selections ignore \r in input

Now the selection engine treats \r (as well as various other space
characters) the same as a space.  Added a unit test for this.
There is an extra trailing space in some cases that may be more common
with \r\n than otherwise, but that is a separate, mostly cosmetic
issue.

Fixes #1555

Change-Id: I78dfe8e477133b98a98fecf1fad243262f9b30c8