Improve stability of text selection