patch 8.0.0836: can abandon a terminal buffer after making a change
Problem: When a terminal buffer is changed it can still be accidentally
abandoned.
Solution: When making a change reset the 'buftype' option.
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 8df690c..154aab9 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -6,7 +6,7 @@
source shared.vim
-func Test_terminal_basic()
+func Run_shell_in_terminal()
let buf = term_start(&shell)
let termlist = term_list()
@@ -20,6 +20,25 @@
call WaitFor('job_status(g:job) == "dead"')
call assert_equal('dead', job_status(g:job))
+ return buf
+endfunc
+
+func Test_terminal_basic()
+ let buf = Run_shell_in_terminal()
+
+ exe buf . 'bwipe'
+ unlet g:job
+endfunc
+
+func Test_terminal_make_change()
+ let buf = Run_shell_in_terminal()
+ call term_wait(buf)
+
+ setlocal modifiable
+ exe "normal Axxx\<Esc>"
+ call assert_fails(buf . 'bwipe', 'E517')
+ undo
+
exe buf . 'bwipe'
unlet g:job
endfunc