autopairing fix for selection wrapping