Mercurial > vim
diff src/option.c @ 6817:cd47def2214a v7.4.730
patch 7.4.730
Problem: When setting the crypt key and using a swap file, text may be
encrypted twice or unencrypted text remains in the swap file.
(Issue 369)
Solution: Call ml_preserve() before re-encrypting. Set correct index for
next pointer block.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 09 Jun 2015 18:35:25 +0200 |
parents | 64a32aca7919 |
children | 0f1cc87630d8 |
line wrap: on
line diff
--- a/src/option.c +++ b/src/option.c @@ -6163,7 +6163,8 @@ did_set_string_option(opt_idx, varp, new # endif if (STRCMP(curbuf->b_p_key, oldval) != 0) /* Need to update the swapfile. */ - ml_set_crypt_key(curbuf, oldval, crypt_get_method_nr(curbuf)); + ml_set_crypt_key(curbuf, oldval, + *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm); } else if (gvarp == &p_cm) @@ -6207,8 +6208,7 @@ did_set_string_option(opt_idx, varp, new else p = curbuf->b_p_cm; if (STRCMP(s, p) != 0) - ml_set_crypt_key(curbuf, curbuf->b_p_key, - crypt_method_nr_from_name(s)); + ml_set_crypt_key(curbuf, curbuf->b_p_key, s); /* If the global value changes need to update the swapfile for all * buffers using that value. */ @@ -6218,8 +6218,7 @@ did_set_string_option(opt_idx, varp, new for (buf = firstbuf; buf != NULL; buf = buf->b_next) if (buf != curbuf && *buf->b_p_cm == NUL) - ml_set_crypt_key(buf, buf->b_p_key, - crypt_method_nr_from_name(oldval)); + ml_set_crypt_key(buf, buf->b_p_key, oldval); } } }