summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorRob Pilling <robpilling@gmail.com>2022-12-23 19:06:04 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-23 19:06:04 +0000
commite86190e7c1297da29d0fc2415fdeca5ecae8d2ba (patch)
treeaf6d793030ca6c8c5f785d30b0637b910cb6fde2 /src/ex_cmds.c
parentf54cedd6763e7727b4bfaeb34bb7c365a17675eb (diff)
patch 9.0.1092: search error message doesn't show used patternv9.0.1092
Problem: Search error message doesn't show used pattern. Solution: Pass the actually used pattern to where the error message is given. (Rob Pilling, closes #11742)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 5b398089fd..693b0acace 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1902,12 +1902,12 @@ check_writable(char_u *fname)
#endif
/*
- * write current buffer to file 'eap->arg'
- * if 'eap->append' is TRUE, append to the file
+ * Write the current buffer to file "eap->arg".
+ * If "eap->append" is TRUE, append to the file.
*
- * if *eap->arg == NUL write to current file
+ * If "*eap->arg == NUL" write to current file.
*
- * return FAIL for failure, OK otherwise
+ * Return FAIL for failure, OK otherwise.
*/
int
do_write(exarg_T *eap)
@@ -4011,7 +4011,7 @@ ex_substitute(exarg_T *eap)
return;
}
- if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, &regmatch) == FAIL)
+ if (search_regcomp(pat, NULL, RE_SUBST, which_pat, SEARCH_HIS, &regmatch) == FAIL)
{
if (subflags.do_error)
emsg(_(e_invalid_command));
@@ -5039,6 +5039,7 @@ ex_global(exarg_T *eap)
char_u delim; // delimiter, normally '/'
char_u *pat;
+ char_u *used_pat;
regmmatch_T regmatch;
int match;
int which_pat;
@@ -5104,7 +5105,7 @@ ex_global(exarg_T *eap)
*cmd++ = NUL; // replace it with a NUL
}
- if (search_regcomp(pat, RE_BOTH, which_pat, SEARCH_HIS, &regmatch) == FAIL)
+ if (search_regcomp(pat, &used_pat, RE_BOTH, which_pat, SEARCH_HIS, &regmatch) == FAIL)
{
emsg(_(e_invalid_command));
return;
@@ -5148,16 +5149,16 @@ ex_global(exarg_T *eap)
if (type == 'v')
{
if (in_vim9script())
- semsg(_(e_pattern_found_in_every_line_str), pat);
+ semsg(_(e_pattern_found_in_every_line_str), used_pat);
else
- smsg(_("Pattern found in every line: %s"), pat);
+ smsg(_("Pattern found in every line: %s"), used_pat);
}
else
{
if (in_vim9script())
- semsg(_(e_pattern_not_found_str), pat);
+ semsg(_(e_pattern_not_found_str), used_pat);
else
- smsg(_("Pattern not found: %s"), pat);
+ smsg(_("Pattern not found: %s"), used_pat);
}
}
else