From c2f3e361c52ec4e7149ea1d8c6a1202e0873da8e Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 19 Apr 2017 19:11:50 +0300 Subject: *: Add comment to all C files --- src/nvim/api/ui.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index de60339e5f..3cc2870792 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include -- cgit From 9cdbbd49825561d642705990a2704b2241cf0584 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Mon, 17 Apr 2017 11:32:14 +0200 Subject: ui: support more cursor shape modes throttle unneccessary cursor shape events --- src/nvim/api/ui.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index de60339e5f..0053050717 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -266,19 +266,14 @@ static void remote_ui_mouse_off(UI *ui) push_call(ui, "mouse_off", args); } -static void remote_ui_mode_change(UI *ui, int mode) +static void remote_ui_mode_change(UI *ui, int mode_idx) { Array args = ARRAY_DICT_INIT; - if (mode == INSERT) { - ADD(args, STRING_OBJ(cstr_to_string("insert"))); - } else if (mode == REPLACE) { - ADD(args, STRING_OBJ(cstr_to_string("replace"))); - } else if (mode == CMDLINE) { - ADD(args, STRING_OBJ(cstr_to_string("cmdline"))); - } else { - assert(mode == NORMAL); - ADD(args, STRING_OBJ(cstr_to_string("normal"))); - } + + char *full_name = shape_table[mode_idx].full_name; + ADD(args, STRING_OBJ(cstr_to_string(full_name))); + + ADD(args, INTEGER_OBJ(mode_idx)); push_call(ui, "mode_change", args); } @@ -393,8 +388,10 @@ static void remote_ui_update_sp(UI *ui, int sp) static void remote_ui_flush(UI *ui) { UIData *data = ui->data; - channel_send_event(data->channel_id, "redraw", data->buffer); - data->buffer = (Array)ARRAY_DICT_INIT; + if (data->buffer.size > 0) { + channel_send_event(data->channel_id, "redraw", data->buffer); + data->buffer = (Array)ARRAY_DICT_INIT; + } } static void remote_ui_suspend(UI *ui) -- cgit From 7ea5c78687168c07bfc4582c84145e86a5252f94 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Tue, 18 Apr 2017 13:42:04 +0200 Subject: ui: use an array for mode styles --- src/nvim/api/ui.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 0053050717..3e7e2718bb 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -70,7 +70,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, ui->clear = remote_ui_clear; ui->eol_clear = remote_ui_eol_clear; ui->cursor_goto = remote_ui_cursor_goto; - ui->cursor_style_set = remote_ui_cursor_style_set; + ui->mode_info_set = remote_ui_mode_info_set; ui->update_menu = remote_ui_update_menu; ui->busy_start = remote_ui_busy_start; ui->busy_stop = remote_ui_busy_stop; @@ -295,12 +295,12 @@ static void remote_ui_scroll(UI *ui, int count) push_call(ui, "scroll", args); } -static void remote_ui_cursor_style_set(UI *ui, bool enabled, Dictionary data) +static void remote_ui_mode_info_set(UI *ui, bool guicursor_enabled, Array data) { Array args = ARRAY_DICT_INIT; - ADD(args, BOOLEAN_OBJ(enabled)); - ADD(args, copy_object(DICTIONARY_OBJ(data))); - push_call(ui, "cursor_style_set", args); + ADD(args, BOOLEAN_OBJ(guicursor_enabled)); + ADD(args, copy_object(ARRAY_OBJ(data))); + push_call(ui, "mode_info_set", args); } static void remote_ui_highlight_set(UI *ui, HlAttrs attrs) -- cgit From 5c9860a0a2bf27d409c986673f0a74542561c4c3 Mon Sep 17 00:00:00 2001 From: Sander Bosma Date: Wed, 1 Mar 2017 10:43:47 +0100 Subject: api: Do not truncate errors <1 MB. #6237 Closes #5984 --- src/nvim/api/ui.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 2a33d2ad72..534274db0f 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -55,12 +55,12 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, Exception, _("UI already attached for channel")); + _api_set_error(err, kErrorTypeException, _("UI already attached for channel")); return; } if (width <= 0 || height <= 0) { - api_set_error(err, Validation, + _api_set_error(err, kErrorTypeValidation, _("Expected width > 0 and height > 0")); return; } @@ -126,7 +126,7 @@ void nvim_ui_detach(uint64_t channel_id, Error *err) FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, Exception, _("UI is not attached for channel")); + _api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); return; } remote_ui_disconnect(channel_id); @@ -138,12 +138,12 @@ void nvim_ui_try_resize(uint64_t channel_id, Integer width, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, Exception, _("UI is not attached for channel")); + _api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); return; } if (width <= 0 || height <= 0) { - api_set_error(err, Validation, + _api_set_error(err, kErrorTypeValidation, _("Expected width > 0 and height > 0")); return; } @@ -159,7 +159,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(error, Exception, _("UI is not attached for channel")); + _api_set_error(error, kErrorTypeException, _("UI is not attached for channel")); return; } UI *ui = pmap_get(uint64_t)(connected_uis, channel_id); @@ -173,19 +173,19 @@ void nvim_ui_set_option(uint64_t channel_id, String name, static void ui_set_option(UI *ui, String name, Object value, Error *error) { if (strcmp(name.data, "rgb") == 0) { if (value.type != kObjectTypeBoolean) { - api_set_error(error, Validation, _("rgb must be a Boolean")); + _api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean")); return; } ui->rgb = value.data.boolean; } else if (strcmp(name.data, "popupmenu_external") == 0) { if (value.type != kObjectTypeBoolean) { - api_set_error(error, Validation, + _api_set_error(error, kErrorTypeValidation, _("popupmenu_external must be a Boolean")); return; } ui->pum_external = value.data.boolean; } else { - api_set_error(error, Validation, _("No such ui option")); + _api_set_error(error, kErrorTypeValidation, _("No such ui option")); } } -- cgit From 2ed91f222f1dddda10fbdc9cb80df2be7d4c2da3 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 19:58:13 +0200 Subject: api/internal: Remove `set` field from Error type. --- src/nvim/api/ui.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 534274db0f..4c39bc57eb 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -97,7 +97,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, for (size_t i = 0; i < options.size; i++) { ui_set_option(ui, options.items[i].key, options.items[i].value, err); - if (err->set) { + if (ERROR_SET(err)) { xfree(ui); return; } @@ -165,7 +165,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name, UI *ui = pmap_get(uint64_t)(connected_uis, channel_id); ui_set_option(ui, name, value, error); - if (!error->set) { + if (!ERROR_SET(error)) { ui_refresh(); } } -- cgit From 3fbc660d57f4726044662bde1bf52c527e45fb98 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 21:54:44 +0200 Subject: api_set_error(): rename --- src/nvim/api/ui.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 4c39bc57eb..26c0a8119b 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -55,12 +55,12 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (pmap_has(uint64_t)(connected_uis, channel_id)) { - _api_set_error(err, kErrorTypeException, _("UI already attached for channel")); + api_set_error(err, kErrorTypeException, _("UI already attached for channel")); return; } if (width <= 0 || height <= 0) { - _api_set_error(err, kErrorTypeValidation, + api_set_error(err, kErrorTypeValidation, _("Expected width > 0 and height > 0")); return; } @@ -126,7 +126,7 @@ void nvim_ui_detach(uint64_t channel_id, Error *err) FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - _api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); return; } remote_ui_disconnect(channel_id); @@ -138,12 +138,12 @@ void nvim_ui_try_resize(uint64_t channel_id, Integer width, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - _api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); return; } if (width <= 0 || height <= 0) { - _api_set_error(err, kErrorTypeValidation, + api_set_error(err, kErrorTypeValidation, _("Expected width > 0 and height > 0")); return; } @@ -159,7 +159,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - _api_set_error(error, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(error, kErrorTypeException, _("UI is not attached for channel")); return; } UI *ui = pmap_get(uint64_t)(connected_uis, channel_id); @@ -173,19 +173,19 @@ void nvim_ui_set_option(uint64_t channel_id, String name, static void ui_set_option(UI *ui, String name, Object value, Error *error) { if (strcmp(name.data, "rgb") == 0) { if (value.type != kObjectTypeBoolean) { - _api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean")); + api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean")); return; } ui->rgb = value.data.boolean; } else if (strcmp(name.data, "popupmenu_external") == 0) { if (value.type != kObjectTypeBoolean) { - _api_set_error(error, kErrorTypeValidation, + api_set_error(error, kErrorTypeValidation, _("popupmenu_external must be a Boolean")); return; } ui->pum_external = value.data.boolean; } else { - _api_set_error(error, kErrorTypeValidation, _("No such ui option")); + api_set_error(error, kErrorTypeValidation, _("No such ui option")); } } -- cgit From 086c354a0aad2769042dc91bf5bad021109f56e4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 22:30:08 +0200 Subject: api: Do not translate error messages. Also re-word some error messages: - "Key does not exist: %s" - "Invalid channel: %" - "Request array size must be 4 (request) or 3 (notification)" - "String cannot contain newlines" References #6150 --- src/nvim/api/ui.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 26c0a8119b..f0da0d1812 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -55,13 +55,13 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, kErrorTypeException, _("UI already attached for channel")); + api_set_error(err, kErrorTypeException, "UI already attached for channel"); return; } if (width <= 0 || height <= 0) { api_set_error(err, kErrorTypeValidation, - _("Expected width > 0 and height > 0")); + "Expected width > 0 and height > 0"); return; } UI *ui = xcalloc(1, sizeof(UI)); @@ -126,7 +126,7 @@ void nvim_ui_detach(uint64_t channel_id, Error *err) FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(err, kErrorTypeException, "UI is not attached for channel"); return; } remote_ui_disconnect(channel_id); @@ -138,13 +138,13 @@ void nvim_ui_try_resize(uint64_t channel_id, Integer width, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(err, kErrorTypeException, "UI is not attached for channel"); return; } if (width <= 0 || height <= 0) { api_set_error(err, kErrorTypeValidation, - _("Expected width > 0 and height > 0")); + "Expected width > 0 and height > 0"); return; } @@ -159,7 +159,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(error, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(error, kErrorTypeException, "UI is not attached for channel"); return; } UI *ui = pmap_get(uint64_t)(connected_uis, channel_id); @@ -173,19 +173,19 @@ void nvim_ui_set_option(uint64_t channel_id, String name, static void ui_set_option(UI *ui, String name, Object value, Error *error) { if (strcmp(name.data, "rgb") == 0) { if (value.type != kObjectTypeBoolean) { - api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean")); + api_set_error(error, kErrorTypeValidation, "rgb must be a Boolean"); return; } ui->rgb = value.data.boolean; } else if (strcmp(name.data, "popupmenu_external") == 0) { if (value.type != kObjectTypeBoolean) { api_set_error(error, kErrorTypeValidation, - _("popupmenu_external must be a Boolean")); + "popupmenu_external must be a Boolean"); return; } ui->pum_external = value.data.boolean; } else { - api_set_error(error, kErrorTypeValidation, _("No such ui option")); + api_set_error(error, kErrorTypeValidation, "No such ui option"); } } -- cgit From 88023d51238698dd625c26300142d3dbe5770b73 Mon Sep 17 00:00:00 2001 From: Dongdong Zhou Date: Fri, 24 Feb 2017 09:35:27 +0000 Subject: api/ui: externalize tabline --- src/nvim/api/ui.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index f0da0d1812..28fc641dec 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -69,6 +69,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, ui->height = (int)height; ui->rgb = true; ui->pum_external = false; + ui->tabline_external = false; ui->resize = remote_ui_resize; ui->clear = remote_ui_clear; ui->eol_clear = remote_ui_eol_clear; @@ -171,19 +172,26 @@ void nvim_ui_set_option(uint64_t channel_id, String name, } static void ui_set_option(UI *ui, String name, Object value, Error *error) { - if (strcmp(name.data, "rgb") == 0) { + if (strequal(name.data, "rgb")) { if (value.type != kObjectTypeBoolean) { api_set_error(error, kErrorTypeValidation, "rgb must be a Boolean"); return; } ui->rgb = value.data.boolean; - } else if (strcmp(name.data, "popupmenu_external") == 0) { + } else if (strequal(name.data, "popupmenu_external")) { if (value.type != kObjectTypeBoolean) { api_set_error(error, kErrorTypeValidation, "popupmenu_external must be a Boolean"); return; } ui->pum_external = value.data.boolean; + } else if (strequal(name.data, "tabline_external")) { + if (value.type != kObjectTypeBoolean) { + api_set_error(error, kErrorTypeValidation, + "tabline_external must be a Boolean"); + return; + } + ui->tabline_external = value.data.boolean; } else { api_set_error(error, kErrorTypeValidation, "No such ui option"); } -- cgit From 00843902d3472ac4e74106fc06fa60e599914496 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 25 Apr 2017 02:17:15 +0200 Subject: api/ui: externalize tabline - Work with a bool[] array parallel to the UIWidget enum. - Rename some functions. - Documentation. --- src/nvim/api/ui.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 28fc641dec..08d285eedc 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -68,8 +68,6 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, ui->width = (int)width; ui->height = (int)height; ui->rgb = true; - ui->pum_external = false; - ui->tabline_external = false; ui->resize = remote_ui_resize; ui->clear = remote_ui_clear; ui->eol_clear = remote_ui_eol_clear; @@ -96,6 +94,8 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, ui->set_icon = remote_ui_set_icon; ui->event = remote_ui_event; + memset(ui->ui_ext, 0, sizeof(ui->ui_ext)); + for (size_t i = 0; i < options.size; i++) { ui_set_option(ui, options.items[i].key, options.items[i].value, err); if (ERROR_SET(err)) { @@ -171,7 +171,8 @@ void nvim_ui_set_option(uint64_t channel_id, String name, } } -static void ui_set_option(UI *ui, String name, Object value, Error *error) { +static void ui_set_option(UI *ui, String name, Object value, Error *error) +{ if (strequal(name.data, "rgb")) { if (value.type != kObjectTypeBoolean) { api_set_error(error, kErrorTypeValidation, "rgb must be a Boolean"); @@ -179,19 +180,42 @@ static void ui_set_option(UI *ui, String name, Object value, Error *error) { } ui->rgb = value.data.boolean; } else if (strequal(name.data, "popupmenu_external")) { + // LEGACY: Deprecated option, use `ui_ext` instead. if (value.type != kObjectTypeBoolean) { api_set_error(error, kErrorTypeValidation, "popupmenu_external must be a Boolean"); return; } - ui->pum_external = value.data.boolean; - } else if (strequal(name.data, "tabline_external")) { - if (value.type != kObjectTypeBoolean) { + ui->ui_ext[kUIPopupmenu] = value.data.boolean; + } else if (strequal(name.data, "ui_ext")) { + if (value.type != kObjectTypeArray) { api_set_error(error, kErrorTypeValidation, - "tabline_external must be a Boolean"); + "ui_ext must be an Array"); return; } - ui->tabline_external = value.data.boolean; + + for (size_t i = 0; i < value.data.array.size; i++) { + Object item = value.data.array.items[i]; + if (item.type != kObjectTypeString) { + api_set_error(error, kErrorTypeValidation, + "ui_ext: item must be a String"); + return; + } + char *name = item.data.string.data; + if (strequal(name, "cmdline")) { + ui->ui_ext[kUICmdline] = true; + } else if (strequal(name, "popupmenu")) { + ui->ui_ext[kUIPopupmenu] = true; + } else if (strequal(name, "tabline")) { + ui->ui_ext[kUITabline] = true; + } else if (strequal(name, "wildmenu")) { + ui->ui_ext[kUIWildmenu] = true; + } else { + api_set_error(error, kErrorTypeValidation, + "ui_ext: unknown widget: %s", name); + return; + } + } } else { api_set_error(error, kErrorTypeValidation, "No such ui option"); } -- cgit From c8e1af93de90b2e23579f726fd4aa6a65f9387b6 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 25 Apr 2017 10:14:29 +0200 Subject: api: nvim_ui_attach(): Flatten ext_* options. --- src/nvim/api/ui.c | 57 ++++++++++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 32 deletions(-) (limited to 'src/nvim/api/ui.c') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 08d285eedc..3c0e8bc049 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -173,13 +173,33 @@ void nvim_ui_set_option(uint64_t channel_id, String name, static void ui_set_option(UI *ui, String name, Object value, Error *error) { +#define UI_EXT_OPTION(o, e) \ + do { \ + if (strequal(name.data, #o)) { \ + if (value.type != kObjectTypeBoolean) { \ + api_set_error(error, kErrorTypeValidation, #o " must be a Boolean"); \ + return; \ + } \ + ui->ui_ext[(e)] = value.data.boolean; \ + return; \ + } \ + } while (0) + if (strequal(name.data, "rgb")) { if (value.type != kObjectTypeBoolean) { api_set_error(error, kErrorTypeValidation, "rgb must be a Boolean"); return; } ui->rgb = value.data.boolean; - } else if (strequal(name.data, "popupmenu_external")) { + return; + } + + UI_EXT_OPTION(ext_cmdline, kUICmdline); + UI_EXT_OPTION(ext_popupmenu, kUIPopupmenu); + UI_EXT_OPTION(ext_tabline, kUITabline); + UI_EXT_OPTION(ext_wildmenu, kUIWildmenu); + + if (strequal(name.data, "popupmenu_external")) { // LEGACY: Deprecated option, use `ui_ext` instead. if (value.type != kObjectTypeBoolean) { api_set_error(error, kErrorTypeValidation, @@ -187,38 +207,11 @@ static void ui_set_option(UI *ui, String name, Object value, Error *error) return; } ui->ui_ext[kUIPopupmenu] = value.data.boolean; - } else if (strequal(name.data, "ui_ext")) { - if (value.type != kObjectTypeArray) { - api_set_error(error, kErrorTypeValidation, - "ui_ext must be an Array"); - return; - } - - for (size_t i = 0; i < value.data.array.size; i++) { - Object item = value.data.array.items[i]; - if (item.type != kObjectTypeString) { - api_set_error(error, kErrorTypeValidation, - "ui_ext: item must be a String"); - return; - } - char *name = item.data.string.data; - if (strequal(name, "cmdline")) { - ui->ui_ext[kUICmdline] = true; - } else if (strequal(name, "popupmenu")) { - ui->ui_ext[kUIPopupmenu] = true; - } else if (strequal(name, "tabline")) { - ui->ui_ext[kUITabline] = true; - } else if (strequal(name, "wildmenu")) { - ui->ui_ext[kUIWildmenu] = true; - } else { - api_set_error(error, kErrorTypeValidation, - "ui_ext: unknown widget: %s", name); - return; - } - } - } else { - api_set_error(error, kErrorTypeValidation, "No such ui option"); + return; } + + api_set_error(error, kErrorTypeValidation, "No such ui option"); +#undef UI_EXT_OPTION } static void push_call(UI *ui, char *name, Array args) -- cgit