summaryrefslogtreecommitdiffstats
path: root/src/gui.c
diff options
context:
space:
mode:
authormatveyt <matthewtarasov@yandex.ru>2022-09-06 17:00:15 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-06 17:00:15 +0100
commit2834ebdee473c838e50e60d0aa160f0e62fc8ef9 (patch)
tree3c5d2b3a0e3f0c261d5569e5eb96eb5eeec88349 /src/gui.c
parent635bb4908577738c5658a95672259b8537d97d49 (diff)
patch 9.0.0396: :findrepl does not escape '&' and '~' properlyv9.0.0396
Problem: :findrepl does not escape '&' and '~' properly. Solution: Escape depending on the value of 'magic'. (closes #11067)
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui.c b/src/gui.c
index 9c78dacb1a..b9217b4590 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -5360,8 +5360,10 @@ gui_do_findrepl(
if (type == FRD_REPLACEALL)
{
ga_concat(&ga, (char_u *)"/");
- // escape slash and backslash
- p = vim_strsave_escaped(repl_text, (char_u *)"/\\");
+ // Escape slash and backslash.
+ // Also escape tilde and ampersand if 'magic' is set.
+ p = vim_strsave_escaped(repl_text,
+ p_magic ? (char_u *)"/\\~&" : (char_u *)"/\\");
if (p != NULL)
ga_concat(&ga, p);
vim_free(p);