diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-04-20 14:50:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-20 14:50:04 +0200 |
commit | 81f1e33d15def4fe55255503a7806dfd1078bd41 (patch) | |
tree | c19dbbf83b8959cf37a85a0d2a2ca112e2afd06d /src/nvim/api/ui.c | |
parent | a391cd517bb4f0d638da3f0aaaf57f98e153447e (diff) | |
parent | 8973768a4e317ceccb12442ba40b5456d3f239cb (diff) | |
download | rneovim-81f1e33d15def4fe55255503a7806dfd1078bd41.tar.gz rneovim-81f1e33d15def4fe55255503a7806dfd1078bd41.tar.bz2 rneovim-81f1e33d15def4fe55255503a7806dfd1078bd41.zip |
Merge pull request #18145 from bfredl/term_opt
feat(api): allow remote UI to set terminal options
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r-- | src/nvim/api/ui.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index d86aecc318..383c9c16ab 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -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"); |