rufo
rufo copied to clipboard
Rufo modifies escape characters
With the code:
def regexp
%r{
\b # word boundary
([\w\-.]) # $1: username; first letter
@ # at
([a-z\d\-.]+) # $2: domain except TLD
\. # dot
([a-z]+) # $3: TLD
\b # word boundary
}xi
end
Running rufo (0.12.0 - running on Mac / ruby 2.6.5) changes this to:
def regexp
%r{
^H # word boundary
([\w\-.]) # $1: username; first letter
@ # at
([a-z\d\-.]+) # $2: domain except TLD
\. # dot
([a-z]+) # $3: TLD
^H # word boundary
}xi
end
E.g. the \b word boundary regex matcher is interpreted as backspace and then turned into the CTRL-H (backspace) control character on completion
@phantomwhale I tried to reproduce this but was not able to. I wrote a test for the case you have here: https://github.com/ruby-formatter/rufo/compare/bug/regex-escape-characters?expand=1 but the tests pass in all versions of ruby.
Would you be able to do some more digging on your side? A PR with a failing test would be great.