summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/optionstr.c3
-rw-r--r--src/testdir/test_crypt.vim26
-rw-r--r--src/version.c2
3 files changed, 31 insertions, 0 deletions
diff --git a/src/optionstr.c b/src/optionstr.c
index 17613a656..ff0186f42 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -1157,8 +1157,11 @@ did_set_string_option(
if (STRCMP(curbuf->b_p_key, oldval) != 0)
// Need to update the swapfile.
+ {
ml_set_crypt_key(curbuf, oldval,
*curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
+ changed_internal();
+ }
}
else if (gvarp == &p_cm)
diff --git a/src/testdir/test_crypt.vim b/src/testdir/test_crypt.vim
index ab62d8470..fa26ba550 100644
--- a/src/testdir/test_crypt.vim
+++ b/src/testdir/test_crypt.vim
@@ -110,3 +110,29 @@ func Test_crypt_key_mismatch()
bwipe!
endfunc
+func Test_crypt_set_key_changes_buffer()
+
+ new Xtest1.txt
+ call setline(1, 'nothing')
+ set cryptmethod=blowfish2
+ call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt')
+ call assert_fails(":q", "E37:")
+ w
+ set key=anotherkey
+ call assert_fails(":bw")
+ w
+ call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt')
+ call assert_fails(":bw")
+ w
+ let winnr = winnr()
+ wincmd p
+ call setwinvar(winnr, '&key', 'yetanotherkey')
+ wincmd p
+ call assert_fails(":bw")
+ w
+
+ set cryptmethod&
+ set key=
+ bwipe!
+ call delete('Xtest1.txt')
+endfunc
diff --git a/src/version.c b/src/version.c
index c631d54fe..90773d3f9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 762,
+/**/
761,
/**/
760,