aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-08-24 18:19:24 +0800
committerGitHub <noreply@github.com>2024-08-24 10:19:24 +0000
commit91ce0c3ddda7659de9adc85601d6a7d6cf05f681 (patch)
tree92b8ca3bcf6d2ffaaa6b65d4da6cc1ae67e7b131 /src
parentbb4b6b427c1952b4a9b72f406b913ec59f0d4d22 (diff)
downloadrneovim-91ce0c3ddda7659de9adc85601d6a7d6cf05f681.tar.gz
rneovim-91ce0c3ddda7659de9adc85601d6a7d6cf05f681.tar.bz2
rneovim-91ce0c3ddda7659de9adc85601d6a7d6cf05f681.zip
vim-patch:9.1.0692: Wrong patlen value in ex_substitute() (#30131)
Problem: Wrong patlen value in ex_substitute() (after 9.1.0426). Solution: Compute patlen after finding end separator. (zeertzjq) Add a more explicit test. The test already passes as the only case where a overlarge patlen value matters was fixed by patch 9.1.0689. closes: vim/vim#15565 https://github.com/vim/vim/commit/d1c8d2de4b9fa44b3d2b39b7ed8b92846c5502b7
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 5e87936be1..6ac73527ee 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3378,12 +3378,12 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const int cmdpreview_n
which_pat = RE_LAST; // use last used regexp
delimiter = (uint8_t)(*cmd++); // remember delimiter character
pat = cmd; // remember start of search pat
- patlen = strlen(pat);
cmd = skip_regexp_ex(cmd, delimiter, magic_isset(), &eap->arg, NULL, NULL);
if (cmd[0] == delimiter) { // end delimiter found
*cmd++ = NUL; // replace it with a NUL
has_second_delim = true;
}
+ patlen = strlen(pat);
}
// Small incompatibility: vi sees '\n' as end of the command, but in