From 75a9ed164b1a2f9db7b0eb59e6881cb931559866 Mon Sep 17 00:00:00 2001 From: Hilda24 <54671845+Hilda24@users.noreply.github.com> Date: Wed, 30 Apr 2025 07:25:02 +0530 Subject: [PATCH] vim: Fix incorrect escaping parenthesis of replacement string (#29555) Closes #29356 ![Screenshot 2025-04-28 233018](https://github.com/user-attachments/assets/22998e70-8430-45fc-8d51-14e862e585eb) Release Notes: - vim: Fixed a bug when escaping `(` and `)` in command-palette find and replace --- crates/vim/src/normal/search.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/vim/src/normal/search.rs b/crates/vim/src/normal/search.rs index da8f65c1cf..2f723198b6 100644 --- a/crates/vim/src/normal/search.rs +++ b/crates/vim/src/normal/search.rs @@ -542,7 +542,7 @@ impl Replacement { if phase == 1 && c.is_ascii_digit() { buffer.push('$') // unescape escaped parens - } else if phase == 0 && c == '(' || c == ')' { + } else if phase == 0 && (c == '(' || c == ')') { } else if c != delimiter { buffer.push('\\') } @@ -561,7 +561,7 @@ impl Replacement { } } else { // escape unescaped parens - if phase == 0 && c == '(' || c == ')' { + if phase == 0 && (c == '(' || c == ')') { buffer.push('\\') } buffer.push(c)