mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 15:38:33 +00:00
feat(tui): run TUI as external process
This commit is contained in:
@@ -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");
|
||||
|
||||
|
@@ -31,7 +31,7 @@ void visual_bell(void)
|
||||
void flush(void)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL;
|
||||
void suspend(void)
|
||||
FUNC_API_SINCE(3) FUNC_API_BRIDGE_IMPL;
|
||||
FUNC_API_SINCE(3);
|
||||
void set_title(String title)
|
||||
FUNC_API_SINCE(3);
|
||||
void set_icon(String icon)
|
||||
@@ -39,7 +39,7 @@ void set_icon(String icon)
|
||||
void screenshot(String path)
|
||||
FUNC_API_SINCE(7) FUNC_API_REMOTE_IMPL;
|
||||
void option_set(String name, Object value)
|
||||
FUNC_API_SINCE(4) FUNC_API_BRIDGE_IMPL;
|
||||
FUNC_API_SINCE(4);
|
||||
// Stop event is not exported as such, represented by EOF in the msgpack stream.
|
||||
void stop(void)
|
||||
FUNC_API_NOEXPORT;
|
||||
@@ -73,9 +73,9 @@ void default_colors_set(Integer rgb_fg, Integer rgb_bg, Integer rgb_sp, Integer
|
||||
Integer cterm_bg)
|
||||
FUNC_API_SINCE(4) FUNC_API_REMOTE_IMPL;
|
||||
void hl_attr_define(Integer id, HlAttrs rgb_attrs, HlAttrs cterm_attrs, Array info)
|
||||
FUNC_API_SINCE(5) FUNC_API_REMOTE_IMPL FUNC_API_BRIDGE_IMPL;
|
||||
FUNC_API_SINCE(5) FUNC_API_REMOTE_IMPL;
|
||||
void hl_group_set(String name, Integer id)
|
||||
FUNC_API_SINCE(6) FUNC_API_BRIDGE_IMPL;
|
||||
FUNC_API_SINCE(6);
|
||||
void grid_resize(Integer grid, Integer width, Integer height)
|
||||
FUNC_API_SINCE(5) FUNC_API_REMOTE_IMPL FUNC_API_COMPOSITOR_IMPL FUNC_API_CLIENT_IMPL;
|
||||
void grid_clear(Integer grid)
|
||||
@@ -112,8 +112,9 @@ void win_hide(Integer grid)
|
||||
FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY;
|
||||
void win_close(Integer grid)
|
||||
FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY;
|
||||
|
||||
void msg_set_pos(Integer grid, Integer row, Boolean scrolled, String sep_char)
|
||||
FUNC_API_SINCE(6) FUNC_API_BRIDGE_IMPL FUNC_API_COMPOSITOR_IMPL;
|
||||
FUNC_API_SINCE(6) FUNC_API_COMPOSITOR_IMPL;
|
||||
|
||||
void win_viewport(Integer grid, Window win, Integer topline, Integer botline, Integer curline,
|
||||
Integer curcol, Integer line_count)
|
||||
@@ -149,11 +150,11 @@ void cmdline_block_hide(void)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
|
||||
void wildmenu_show(Array items)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL FUNC_API_BRIDGE_IMPL;
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL;
|
||||
void wildmenu_select(Integer selected)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL FUNC_API_BRIDGE_IMPL;
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL;
|
||||
void wildmenu_hide(void)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL FUNC_API_BRIDGE_IMPL;
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL;
|
||||
|
||||
void msg_show(String kind, Array content, Boolean replace_last)
|
||||
FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY;
|
||||
|
Reference in New Issue
Block a user