Linkification bugfixes

These patches fix bugs with the placement of links:

* The last character of a link's text wasn't being made clickable
* The clickable portion of the line doesn't line up with the link text if the link is on a line containing non-BMP characters, combining characters or East Asian wide characters

Lightly tested on various emulators and on a phone and tablet running 4.4.