api: add metadata for ui events

This commit is contained in:
Björn Linse
2017-04-30 14:35:36 +02:00
parent 7d6af9985c
commit e82cb5de4a
7 changed files with 106 additions and 32 deletions

View File

@@ -33,6 +33,7 @@ typedef struct {
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/helpers.c.generated.h"
# include "api/private/funcs_metadata.generated.h"
# include "api/private/ui_events_metadata.generated.h"
#endif
/// Start block that may cause vimscript exceptions
@@ -820,6 +821,7 @@ Dictionary api_metadata(void)
if (!metadata.size) {
PUT(metadata, "version", DICTIONARY_OBJ(version_dict()));
init_function_metadata(&metadata);
init_ui_event_metadata(&metadata);
init_error_type_metadata(&metadata);
init_type_metadata(&metadata);
}
@@ -843,6 +845,22 @@ static void init_function_metadata(Dictionary *metadata)
PUT(*metadata, "functions", functions);
}
static void init_ui_event_metadata(Dictionary *metadata)
{
msgpack_unpacked unpacked;
msgpack_unpacked_init(&unpacked);
if (msgpack_unpack_next(&unpacked,
(const char *)ui_events_metadata,
sizeof(ui_events_metadata),
NULL) != MSGPACK_UNPACK_SUCCESS) {
abort();
}
Object ui_events;
msgpack_rpc_to_object(&unpacked.data, &ui_events);
msgpack_unpacked_destroy(&unpacked);
PUT(*metadata, "ui_events", ui_events);
}
static void init_error_type_metadata(Dictionary *metadata)
{
Dictionary types = ARRAY_DICT_INIT;

View File

@@ -3,41 +3,69 @@
// This file is not compiled, just parsed for definitons
#ifdef INCLUDE_GENERATED_DECLARATIONS
#error "don't include this file, include nvim/ui.h"
# error "don't include this file, include nvim/ui.h"
#endif
#include "nvim/api/private/defs.h"
#include "nvim/func_attr.h"
#include "nvim/ui.h"
void resize(Integer rows, Integer columns);
void clear(void);
void eol_clear(void);
void cursor_goto(Integer row, Integer col);
void mode_info_set(Boolean enabled, Array cursor_styles);
void update_menu(void);
void busy_start(void);
void busy_stop(void);
void mouse_on(void);
void mouse_off(void);
void mode_change(String mode, Integer mode_idx);
void set_scroll_region(Integer top, Integer bot, Integer left, Integer right);
void scroll(Integer count);
void highlight_set(HlAttrs attrs) REMOTE_IMPL BRIDGE_IMPL;
void put(String str);
void bell(void);
void visual_bell(void);
void flush(void) REMOTE_IMPL;
void update_fg(Integer fg);
void update_bg(Integer bg);
void update_sp(Integer sp);
void suspend(void) BRIDGE_IMPL;
void set_title(String title);
void set_icon(String icon);
void resize(Integer rows, Integer columns)
FUNC_API_SINCE(3);
void clear(void)
FUNC_API_SINCE(3);
void eol_clear(void)
FUNC_API_SINCE(3);
void cursor_goto(Integer row, Integer col)
FUNC_API_SINCE(3);
void mode_info_set(Boolean enabled, Array cursor_styles)
FUNC_API_SINCE(3);
void update_menu(void)
FUNC_API_SINCE(3);
void busy_start(void)
FUNC_API_SINCE(3);
void busy_stop(void)
FUNC_API_SINCE(3);
void mouse_on(void)
FUNC_API_SINCE(3);
void mouse_off(void)
FUNC_API_SINCE(3);
void mode_change(String mode, Integer mode_idx)
FUNC_API_SINCE(3);
void set_scroll_region(Integer top, Integer bot, Integer left, Integer right)
FUNC_API_SINCE(3);
void scroll(Integer count)
FUNC_API_SINCE(3);
void highlight_set(HlAttrs attrs)
FUNC_API_SINCE(3) REMOTE_IMPL BRIDGE_IMPL;
void put(String str)
FUNC_API_SINCE(3);
void bell(void)
FUNC_API_SINCE(3);
void visual_bell(void)
FUNC_API_SINCE(3);
void flush(void)
FUNC_API_SINCE(3) REMOTE_IMPL;
void update_fg(Integer fg)
FUNC_API_SINCE(3);
void update_bg(Integer bg)
FUNC_API_SINCE(3);
void update_sp(Integer sp)
FUNC_API_SINCE(3);
void suspend(void)
FUNC_API_SINCE(3) BRIDGE_IMPL;
void set_title(String title)
FUNC_API_SINCE(3);
void set_icon(String icon)
FUNC_API_SINCE(3);
void popupmenu_show(Array items, Integer selected, Integer row, Integer col) REMOTE_ONLY;
void popupmenu_hide(void) REMOTE_ONLY;
void popupmenu_select(Integer selected) REMOTE_ONLY;
void tabline_update(Tabpage current, Array tabs) REMOTE_ONLY;
void popupmenu_show(Array items, Integer selected, Integer row, Integer col)
FUNC_API_SINCE(3) REMOTE_ONLY;
void popupmenu_hide(void)
FUNC_API_SINCE(3) REMOTE_ONLY;
void popupmenu_select(Integer selected)
FUNC_API_SINCE(3) REMOTE_ONLY;
void tabline_update(Tabpage current, Array tabs)
FUNC_API_SINCE(3) REMOTE_ONLY;
#endif // NVIM_API_UI_EVENTS_IN_H