Fix text selection expand (fix #277)