mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
feat(json): convert Blobs to array of byte values
Similiar to how Vim does it, but to be consistent with how Nvim encodes lists, add a space after every comma.
This commit is contained in:
@@ -729,7 +729,25 @@ static inline int convert_to_json_string(garray_T *const gap,
|
||||
|
||||
#undef TYPVAL_ENCODE_CONV_BLOB
|
||||
#define TYPVAL_ENCODE_CONV_BLOB(tv, blob, len) \
|
||||
abort() /* TODO(seandewar) */ \
|
||||
do { \
|
||||
const blob_T *const blob_ = (blob); \
|
||||
const int len_ = (len); \
|
||||
if (len_ == 0) { \
|
||||
ga_concat(gap, "[]"); \
|
||||
} else { \
|
||||
ga_append(gap, '['); \
|
||||
char numbuf[NUMBUFLEN]; \
|
||||
for (int i_ = 0; i_ < len_; i_++) { \
|
||||
if (i_ > 0) { \
|
||||
ga_concat(gap, ", "); \
|
||||
} \
|
||||
vim_snprintf((char *)numbuf, ARRAY_SIZE(numbuf), "%d", \
|
||||
(int)tv_blob_get(blob_, i_)); \
|
||||
ga_concat(gap, numbuf); \
|
||||
} \
|
||||
ga_append(gap, ']'); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#undef TYPVAL_ENCODE_CONV_FUNC_START
|
||||
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
|
||||
|
Reference in New Issue
Block a user