aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 3d3d02fd71..c31242f2ac 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -8607,11 +8607,14 @@ eval_vars (
break;
}
- resultlen = STRLEN(result); /* length of new string */
- if (src[*usedlen] == '<') { /* remove the file name extension */
- ++*usedlen;
- if ((s = vim_strrchr(result, '.')) != NULL && s >= path_tail(result))
+ // Length of new string.
+ resultlen = STRLEN(result);
+ // Remove the file name extension.
+ if (src[*usedlen] == '<') {
+ (*usedlen)++;
+ if ((s = STRRCHR(result, '.')) != NULL && s >= path_tail(result)) {
resultlen = (size_t)(s - result);
+ }
} else if (!skip_mod) {
valid |= modify_fname(src, usedlen, &result, &resultbuf, &resultlen);
if (result == NULL) {