mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.2757: Vim9: blob tests for legacy and Vim9 script are separate
Problem: Vim9: blob tests for legacy and Vim9 script are separate. Solution: Add CheckLegacyAndVim9Success(). Make blob index assign work.
This commit is contained in:
22
src/blob.c
22
src/blob.c
@@ -336,6 +336,28 @@ blob_slice_or_index(
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set bytes "n1" to "n2" (inclusive) in "dest" to the value of "src".
|
||||
* Caller must make sure "src" is a blob.
|
||||
* Returns FAIL if the number of bytes does not match.
|
||||
*/
|
||||
int
|
||||
blob_set_range(blob_T *dest, long n1, long n2, typval_T *src)
|
||||
{
|
||||
int il, ir;
|
||||
|
||||
if (n2 - n1 + 1 != blob_len(src->vval.v_blob))
|
||||
{
|
||||
emsg(_("E972: Blob value does not have the right number of bytes"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
ir = 0;
|
||||
for (il = n1; il <= n2; il++)
|
||||
blob_set(dest, il, blob_get(src->vval.v_blob, ir++));
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* "remove({blob})" function
|
||||
*/
|
||||
|
Reference in New Issue
Block a user