forked from aniani/vim
patch 8.2.0762: buffer is not considered modified after setting crypt key
Problem: Buffer is not considered modified after setting crypt key. Solution: Set the modified flag. (Christian Brabandt, closes #6082)
This commit is contained in:
@@ -1157,8 +1157,11 @@ did_set_string_option(
|
|||||||
|
|
||||||
if (STRCMP(curbuf->b_p_key, oldval) != 0)
|
if (STRCMP(curbuf->b_p_key, oldval) != 0)
|
||||||
// Need to update the swapfile.
|
// Need to update the swapfile.
|
||||||
|
{
|
||||||
ml_set_crypt_key(curbuf, oldval,
|
ml_set_crypt_key(curbuf, oldval,
|
||||||
*curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
|
*curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
|
||||||
|
changed_internal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (gvarp == &p_cm)
|
else if (gvarp == &p_cm)
|
||||||
|
@@ -110,3 +110,29 @@ func Test_crypt_key_mismatch()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
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
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
762,
|
||||||
/**/
|
/**/
|
||||||
761,
|
761,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user