You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When replacing text using a regexp query, with a placeholder in the replacement, special characters such as \t and \n will be replaced, when they should be preserved.
For example, in a JS console:
>'\\test'.replace(/(\\[a-z]+)/,':$1:')>':\test:'
In CodeMirror, this replacement currently results in : est:.
I think this can be fixed by moving .replace(…) so it runs after .unquote(…) in the getReplacement function, I'm just not sure whether this would have any negative effects.
Describe the issue
When replacing text using a regexp query, with a placeholder in the replacement, special characters such as
\t
and\n
will be replaced, when they should be preserved.For example, in a JS console:
In CodeMirror, this replacement currently results in
: est:
.I think this can be fixed by moving
.replace(…)
so it runs after.unquote(…)
in thegetReplacement
function, I'm just not sure whether this would have any negative effects.https://github.com/codemirror/search/blob/7a4a57e52b4af5807d195296c9933c4c7df947f5/src/search.ts#L295-L301
Browser and platform
Chrome, macOS
Reproduction link
https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgoKbmV3IEVkaXRvclZpZXcoewogIGRvYzogYC8vIG9wZW4gdGhlIHNlYXJjaCBwYW5lbCwgZW5hYmxlIHRoZSByZWdleCBvcHRpb24KLy8gYW5kIHJlcGxhY2UgIihcXFxcW2Etel0rKVxcbiIgd2l0aCAiOiQxOlxcbiIKXFx0ZXN0XG5cXHRlc3RcbmAsCiAgZXh0ZW5zaW9uczogW2Jhc2ljU2V0dXBdLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQo=
The text was updated successfully, but these errors were encountered: