mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tui: handle termguicolors rgb value in bridge for now
When/if TUI/bridge teardown is refactored to use events, this commit can be reverted.
This commit is contained in:
parent
5be3865ce7
commit
b8331e1a1c
@ -62,7 +62,7 @@ void set_title(String title)
|
||||
void set_icon(String icon)
|
||||
FUNC_API_SINCE(3);
|
||||
void option_set(String name, Object value)
|
||||
FUNC_API_SINCE(4);
|
||||
FUNC_API_SINCE(4) FUNC_API_BRIDGE_IMPL;
|
||||
|
||||
void popupmenu_show(Array items, Integer selected, Integer row, Integer col)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
|
@ -1172,18 +1172,9 @@ static void tui_option_set(UI *ui, String name, Object value)
|
||||
if (strequal(name.data, "termguicolors")) {
|
||||
ui->rgb = value.data.boolean;
|
||||
invalidate(ui, 0, data->grid.height-1, 0, data->grid.width-1);
|
||||
loop_schedule(&main_loop, event_create(termguicolors_set_event,
|
||||
2, ui, (void *)ui->rgb));
|
||||
}
|
||||
}
|
||||
|
||||
static void termguicolors_set_event(void **argv)
|
||||
{
|
||||
UI *ui = argv[0];
|
||||
TUIData *data = ui->data;
|
||||
data->bridge->bridge.rgb = (Boolean)argv[1];
|
||||
}
|
||||
|
||||
static void invalidate(UI *ui, int top, int bot, int left, int right)
|
||||
{
|
||||
TUIData *data = ui->data;
|
||||
|
@ -163,3 +163,28 @@ static void ui_bridge_suspend_event(void **argv)
|
||||
UI *ui = UI(argv[0]);
|
||||
ui->suspend(ui);
|
||||
}
|
||||
|
||||
static void ui_bridge_option_set(UI *ui, String name, Object value)
|
||||
{
|
||||
String copy_name = copy_string(name);
|
||||
Object *copy_value = xmalloc(sizeof(Object));
|
||||
*copy_value = copy_object(value);
|
||||
UI_BRIDGE_CALL(ui, option_set, 4, ui, copy_name.data,
|
||||
INT2PTR(copy_name.size), copy_value);
|
||||
// TODO(bfredl): when/if TUI/bridge teardown is refactored to use events, the
|
||||
// commit that introduced this special case can be reverted.
|
||||
// For now this is needed for nvim_list_uis().
|
||||
if (strequal(name.data, "termguicolors")) {
|
||||
ui->rgb = value.data.boolean;
|
||||
}
|
||||
}
|
||||
static void ui_bridge_option_set_event(void **argv)
|
||||
{
|
||||
UI *ui = UI(argv[0]);
|
||||
String name = (String){ .data = argv[1], .size = (size_t)argv[2] };
|
||||
Object value = *(Object *)argv[3];
|
||||
ui->option_set(ui, name, value);
|
||||
api_free_string(name);
|
||||
api_free_object(value);
|
||||
xfree(argv[3]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user