diff src/testdir/test_textprop.vim @ 17694:6f9cde96ee3c v8.1.1844

patch 8.1.1844: buffer no longer unloaded when adding text properties commit https://github.com/vim/vim/commit/45311b5274a6ac6e44235dfd4588c6b1bf0d4850 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 13 22:27:32 2019 +0200 patch 8.1.1844: buffer no longer unloaded when adding text properties Problem: Buffer no longer unloaded when adding text properties to it. Solution: Do not create the memfile. (closes https://github.com/vim/vim/issues/4808)
author Bram Moolenaar <Bram@vim.org>
date Tue, 13 Aug 2019 22:30:06 +0200
parents 13d0753511fe
children 52f23198af7f
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -823,3 +823,25 @@ func Test_textprop_remove_from_buf()
   bwipe! x
   close
 endfunc
+
+func Test_textprop_in_unloaded_buf()
+  edit Xaaa
+  call setline(1, 'aaa')
+  write
+  edit Xbbb
+  call setline(1, 'bbb')
+  write
+  let bnr = bufnr('')
+  edit Xaaa
+
+  call prop_type_add('ErrorMsg', #{highlight:'ErrorMsg'})
+  call assert_fails("call prop_add(1, 1, #{end_lnum: 1, endcol: 2, type: 'ErrorMsg', bufnr: bnr})", 'E275:')
+  exe 'buf ' .. bnr
+  call assert_equal('bbb', getline(1))
+  call assert_equal(0, prop_list(1)->len())
+
+  bwipe! Xaaa
+  bwipe! Xbbb
+  cal delete('Xaaa')
+  cal delete('Xbbb')
+endfunc