Fix placement of selection after inserting special character