mirror of
https://github.com/neovim/neovim.git
synced 2025-09-23 19:48:32 +00:00
api: Also shift numbers in api_metadata output
Fixes problem introduced by “api: Allow kObjectTypeNil to be zero without breaking compatibility”: apparently there are clients which use metadata and there are which aren’t. For the first that commit would not be needed, for the second that commit misses this critical piece.
This commit is contained in:
@@ -851,15 +851,18 @@ static void init_type_metadata(Dictionary *metadata)
|
|||||||
Dictionary types = ARRAY_DICT_INIT;
|
Dictionary types = ARRAY_DICT_INIT;
|
||||||
|
|
||||||
Dictionary buffer_metadata = ARRAY_DICT_INIT;
|
Dictionary buffer_metadata = ARRAY_DICT_INIT;
|
||||||
PUT(buffer_metadata, "id", INTEGER_OBJ(kObjectTypeBuffer));
|
PUT(buffer_metadata, "id",
|
||||||
|
INTEGER_OBJ(kObjectTypeBuffer - EXT_OBJECT_TYPE_SHIFT));
|
||||||
PUT(buffer_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_buf_")));
|
PUT(buffer_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_buf_")));
|
||||||
|
|
||||||
Dictionary window_metadata = ARRAY_DICT_INIT;
|
Dictionary window_metadata = ARRAY_DICT_INIT;
|
||||||
PUT(window_metadata, "id", INTEGER_OBJ(kObjectTypeWindow));
|
PUT(window_metadata, "id",
|
||||||
|
INTEGER_OBJ(kObjectTypeWindow - EXT_OBJECT_TYPE_SHIFT));
|
||||||
PUT(window_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_win_")));
|
PUT(window_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_win_")));
|
||||||
|
|
||||||
Dictionary tabpage_metadata = ARRAY_DICT_INIT;
|
Dictionary tabpage_metadata = ARRAY_DICT_INIT;
|
||||||
PUT(tabpage_metadata, "id", INTEGER_OBJ(kObjectTypeTabpage));
|
PUT(tabpage_metadata, "id",
|
||||||
|
INTEGER_OBJ(kObjectTypeTabpage - EXT_OBJECT_TYPE_SHIFT));
|
||||||
PUT(tabpage_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_tabpage_")));
|
PUT(tabpage_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_tabpage_")));
|
||||||
|
|
||||||
PUT(types, "Buffer", DICTIONARY_OBJ(buffer_metadata));
|
PUT(types, "Buffer", DICTIONARY_OBJ(buffer_metadata));
|
||||||
|
@@ -20,13 +20,6 @@
|
|||||||
static msgpack_zone zone;
|
static msgpack_zone zone;
|
||||||
static msgpack_sbuffer sbuffer;
|
static msgpack_sbuffer sbuffer;
|
||||||
|
|
||||||
/// Value by which objects represented as EXT type are shifted
|
|
||||||
///
|
|
||||||
/// Subtracted when packing, added when unpacking. Used to allow moving
|
|
||||||
/// buffer/window/tabpage block inside ObjectType enum. This block yet cannot be
|
|
||||||
/// split or reordered.
|
|
||||||
#define EXT_OBJECT_TYPE_SHIFT kObjectTypeBuffer
|
|
||||||
|
|
||||||
#define HANDLE_TYPE_CONVERSION_IMPL(t, lt) \
|
#define HANDLE_TYPE_CONVERSION_IMPL(t, lt) \
|
||||||
static bool msgpack_rpc_to_##lt(const msgpack_object *const obj, \
|
static bool msgpack_rpc_to_##lt(const msgpack_object *const obj, \
|
||||||
Integer *const arg) \
|
Integer *const arg) \
|
||||||
|
@@ -9,6 +9,13 @@
|
|||||||
#include "nvim/event/wstream.h"
|
#include "nvim/event/wstream.h"
|
||||||
#include "nvim/api/private/defs.h"
|
#include "nvim/api/private/defs.h"
|
||||||
|
|
||||||
|
/// Value by which objects represented as EXT type are shifted
|
||||||
|
///
|
||||||
|
/// Subtracted when packing, added when unpacking. Used to allow moving
|
||||||
|
/// buffer/window/tabpage block inside ObjectType enum. This block yet cannot be
|
||||||
|
/// split or reordered.
|
||||||
|
#define EXT_OBJECT_TYPE_SHIFT kObjectTypeBuffer
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "msgpack_rpc/helpers.h.generated.h"
|
# include "msgpack_rpc/helpers.h.generated.h"
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user