feat(api): ui options relevant for remote TUI

This commit is contained in:
hlpr98
2022-04-16 14:46:20 +02:00
committed by bfredl
parent a8d5a9e819
commit d63ad42e49
4 changed files with 49 additions and 12 deletions

View File

@@ -14,6 +14,7 @@
#include "nvim/map.h"
#include "nvim/memory.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/option.h"
#include "nvim/popupmnu.h"
#include "nvim/screen.h"
#include "nvim/ui.h"
@@ -255,6 +256,33 @@ static void ui_set_option(UI *ui, bool init, String name, Object value, Error *e
return;
}
if (strequal(name.data, "term_name")) {
if (value.type != kObjectTypeString) {
api_set_error(error, kErrorTypeValidation, "term_name must be a String");
return;
}
set_tty_option("term", xstrdup(value.data.string.data));
return;
}
if (strequal(name.data, "term_colors")) {
if (value.type != kObjectTypeInteger) {
api_set_error(error, kErrorTypeValidation, "term_colors must be a Integer");
return;
}
t_colors = (int)value.data.integer;
return;
}
if (strequal(name.data, "term_background")) {
if (value.type != kObjectTypeString) {
api_set_error(error, kErrorTypeValidation, "term_background must be a String");
return;
}
set_tty_background(value.data.string.data);
return;
}
// LEGACY: Deprecated option, use `ext_cmdline` instead.
bool is_popupmenu = strequal(name.data, "popupmenu_external");