]> granicus.if.org Git - vim/commitdiff
patch 8.2.1866: Vim9: appending to pushed blob gives wrong result v8.2.1866
authorBram Moolenaar <Bram@vim.org>
Mon, 19 Oct 2020 18:21:03 +0000 (20:21 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 19 Oct 2020 18:21:03 +0000 (20:21 +0200)
Problem:    Vim9: appending to pushed blob gives wrong result.
Solution:   Set ga_maxlen when copying a blob.

src/blob.c
src/testdir/test_vim9_func.vim
src/version.c

index f105170cfbde971005dacb8743b3d19c0b42bb68..264962e197d93871aa4c0385a13e05bb31a41f65 100644 (file)
@@ -80,6 +80,7 @@ blob_copy(blob_T *from, typval_T *to)
                len = 0;
        }
        to->vval.v_blob->bv_ga.ga_len = len;
+       to->vval.v_blob->bv_ga.ga_maxlen = len;
     }
     return ret;
 }
index bded91f78406ceeb3c39df59bc53a7524243dee1..4af136cefec35541b63776623e2e9389910eb3c3 100644 (file)
@@ -1790,6 +1790,12 @@ def Test_list_add()
   CheckDefExecFailure(lines, 'E1130:', 2)
 enddef
 
+def Test_blob_add()
+  var b: blob = 0z12
+  add(b, 0x34)
+  assert_equal(0z1234, b)
+enddef
+
 def SID(): number
   return expand('<SID>')
           ->matchstr('<SNR>\zs\d\+\ze_$')
index 2894dedb8c71bc13cf263de2c4d4e275e5166adc..1b60ebd2a0c97ae1a7a3d33d4c798631363901e9 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1866,
 /**/
     1865,
 /**/