diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-13 22:27:32 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-13 22:27:32 +0200 |
commit | 45311b5274a6ac6e44235dfd4588c6b1bf0d4850 (patch) | |
tree | 6a4e242e2c509cb3931d7ac8684b7384f69f223c /src | |
parent | f077db24230d10ef9a66ae14da34b639464d8fa2 (diff) |
patch 8.1.1844: buffer no longer unloaded when adding text propertiesv8.1.1844
Problem: Buffer no longer unloaded when adding text properties to it.
Solution: Do not create the memfile. (closes #4808)
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_textprop.vim | 22 | ||||
-rw-r--r-- | src/textprop.c | 5 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 28 insertions, 1 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index d7e77f985f..3d3cce8158 100644 --- 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 diff --git a/src/textprop.c b/src/textprop.c index a976414290..309f3cb795 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -256,7 +256,10 @@ prop_add_common( } if (buf->b_ml.ml_mfp == NULL) - ml_open(buf); + { + emsg(_("E275: Cannot add text property to unloaded buffer")); + return; + } for (lnum = start_lnum; lnum <= end_lnum; ++lnum) { diff --git a/src/version.c b/src/version.c index 5741d5fdaa..f998c52586 100644 --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1844, +/**/ 1843, /**/ 1842, |