a11y: compute properly if there is text selected

https://bugzilla.gnome.org/show_bug.cgi?id=722188