Fix `%r`-literal autocorrect

This fixes an error when `%r(.*)` was corrected to `%r{.*)}` and  `%r(.*)i` was corrected to `%r{.*)i}`.