On second thoughts prevent all backslash escape sequences from being interpreted in normal mode replace strings

This commit is contained in:
Kovid Goyal 2017-01-05 22:17:47 +05:30
parent 41a40e73be
commit 55a06967f7

View File

@ -1219,7 +1219,8 @@ def get_search_function(state):
ans = state['replace'] ans = state['replace']
is_regex = state['mode'] != 'normal' is_regex = state['mode'] != 'normal'
if not is_regex: if not is_regex:
ans = regex.sub(r'\\([0-9g])', r'\\\\\1', ans) # We dont want backslash escape sequences interpreted in normal mode
return lambda m: ans
if state['mode'] == 'function': if state['mode'] == 'function':
try: try:
return replace_functions()[ans] return replace_functions()[ans]