patch 8.1.2125: fnamemodify() fails when repeating :e
Problem: Fnamemodify() fails when repeating :e.
Solution: Do not go before the tail. (Rob Pilling, closes #5024)
diff --git a/src/filepath.c b/src/filepath.c
index 3a06eec..cf401dc 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -563,7 +563,11 @@
}
else // :r
{
- if (s > tail) // remove one extension
+ char_u *limit = *fnamep;
+
+ if (limit < tail)
+ limit = tail;
+ if (s > limit) // remove one extension
*fnamelen = (int)(s - *fnamep);
}
*usedlen += 2;