diff options
author | hlpr98 <hlpr98@gmail.com> | 2019-05-27 22:04:24 +0530 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2022-12-31 10:43:28 +0100 |
commit | 24488169564c39a506c235bf6a33b8e23a8cb528 (patch) | |
tree | 3b30c1fcc3b4ce2fef81d45eebe61baa4f0315ed /src/nvim/api/ui.c | |
parent | 4ace9e7e417fe26c8b73ff1d6042e6e4f3df9ebf (diff) | |
download | rneovim-24488169564c39a506c235bf6a33b8e23a8cb528.tar.gz rneovim-24488169564c39a506c235bf6a33b8e23a8cb528.tar.bz2 rneovim-24488169564c39a506c235bf6a33b8e23a8cb528.zip |
feat(tui): run TUI as external process
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r-- | src/nvim/api/ui.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index aeccddb9ea..ef6ced1ee0 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -14,9 +14,6 @@ #include "nvim/api/private/helpers.h" #include "nvim/api/ui.h" #include "nvim/channel.h" -#include "nvim/event/loop.h" -#include "nvim/event/wstream.h" -#include "nvim/globals.h" #include "nvim/grid.h" #include "nvim/highlight.h" #include "nvim/main.h" @@ -30,6 +27,7 @@ #include "nvim/types.h" #include "nvim/ui.h" #include "nvim/vim.h" +#include "nvim/window.h" typedef struct { uint64_t channel_id; @@ -285,6 +283,19 @@ void ui_attach(uint64_t channel_id, Integer width, Integer height, Boolean enabl api_free_dictionary(opts); } +/// Tells the nvim server if focus was gained by the GUI or not +void nvim_ui_set_focus(uint64_t channel_id, Boolean gained, Error *error) + FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY +{ + if (!pmap_has(uint64_t)(&connected_uis, channel_id)) { + api_set_error(error, kErrorTypeException, + "UI not attached to channel: %" PRId64, channel_id); + return; + } + + autocmd_schedule_focusgained((bool)gained); +} + /// Deactivates UI events on the channel. /// /// Removes the client from the list of UIs. |nvim_list_uis()| @@ -404,6 +415,24 @@ static void ui_set_option(UI *ui, bool init, String name, Object value, Error *e return; } + if (strequal(name.data, "term_ttyin")) { + if (value.type != kObjectTypeInteger) { + api_set_error(error, kErrorTypeValidation, "term_ttyin must be a Integer"); + return; + } + stdin_isatty = (int)value.data.integer; + return; + } + + if (strequal(name.data, "term_ttyout")) { + if (value.type != kObjectTypeInteger) { + api_set_error(error, kErrorTypeValidation, "term_ttyout must be a Integer"); + return; + } + stdout_isatty = (int)value.data.integer; + return; + } + // LEGACY: Deprecated option, use `ext_cmdline` instead. bool is_popupmenu = strequal(name.data, "popupmenu_external"); |