aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-09-15 19:35:10 -0400
committerJustin M. Keyes <justinkz@gmail.com>2018-09-16 11:12:20 +0200
commit3bce5207cf4649974f194b51ffe3e34e08d5184d (patch)
tree2caea358ed7a0e09d6d6554d9301f2447588d74e
parentdadcfe22cab6c4c5e838c0127303bc81638b7283 (diff)
downloadrneovim-3bce5207cf4649974f194b51ffe3e34e08d5184d.tar.gz
rneovim-3bce5207cf4649974f194b51ffe3e34e08d5184d.tar.bz2
rneovim-3bce5207cf4649974f194b51ffe3e34e08d5184d.zip
vim-patch:8.0.1363: recover swap file ending with .stz #9002
Problem: Recovering does not work when swap file ends in .stz. Solution: Check for all possible swap file names. (Elfling, closes vim/vim#2395, closes vim/vim#2396) https://github.com/vim/vim/commit/af903e5d490ec9c6c49079f67de7e92e3c35a725
-rw-r--r--src/nvim/memline.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 61d944eb75..ec9996810f 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -769,17 +769,16 @@ void ml_recover(void)
called_from_main = (curbuf->b_ml.ml_mfp == NULL);
attr = HL_ATTR(HLF_E);
- /*
- * If the file name ends in ".s[uvw][a-z]" we assume this is the swap file.
- * Otherwise a search is done to find the swap file(s).
- */
+ // If the file name ends in ".s[a-w][a-z]" we assume this is the swap file.
+ // Otherwise a search is done to find the swap file(s).
fname = curbuf->b_fname;
if (fname == NULL) /* When there is no file name */
fname = (char_u *)"";
len = (int)STRLEN(fname);
if (len >= 4
&& STRNICMP(fname + len - 4, ".s", 2) == 0
- && vim_strchr((char_u *)"UVWuvw", fname[len - 2]) != NULL
+ && vim_strchr((char_u *)"abcdefghijklmnopqrstuvw",
+ TOLOWER_ASC(fname[len - 2])) != NULL
&& ASCII_ISALPHA(fname[len - 1])) {
directly = TRUE;
fname_used = vim_strsave(fname); /* make a copy for mf_open() */