fix for autopair mode and wrap-region mode