How to use \n in replacement string?
Boscop opened this issue · comments
Boscop commented
When I use \n
in the replacement string, it doesn't work:
$ ambr -r "(?m)Vec3A as Vec3,\n" "Vec3,\n"
./spheres/src/lib.rs: pub resolution: Vec3A as Vec3,
pub time: f32,
-> pub resolution: Vec3,\n pub time: f32,
Replace keyword? [Y]es/[n]o/[a]ll/[q]uit: q
Naoya Hatta commented
I've added escaped charactor support in keyword and replacement like below:
$ ambr "Vec3A as Vec3,\n" "Vec3,\n"
Richard Taityr commented
it's not clear to me how to prevent expansion of escape sequences in the replacement
e.g. to print \n
(backslash n) instead of replacing it with a newline