diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-02-09 22:04:33 +0100 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2025-02-10 18:56:11 +0100 |
| commit | 4b0e2605eaf90268195029a29f10903dc82729e7 (patch) | |
| tree | 76f735084431f5027cdfc90da43370af0f2d2477 /src/nvim/api | |
| parent | ad60b3fb4806c0917010bbe97876c22fb57cabcd (diff) | |
| download | rneovim-4b0e2605eaf90268195029a29f10903dc82729e7.tar.gz rneovim-4b0e2605eaf90268195029a29f10903dc82729e7.tar.bz2 rneovim-4b0e2605eaf90268195029a29f10903dc82729e7.zip | |
feat(ui): UI :detach command
Problem:
Cannot detach the current UI.
Solution:
- Introduce `:detach`.
- Introduce `Channel.detach`.
Co-authored-by: bfredl <bjorn.linse@gmail.com>
Diffstat (limited to 'src/nvim/api')
| -rw-r--r-- | src/nvim/api/ui.c | 2 | ||||
| -rw-r--r-- | src/nvim/api/vim.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index f6f32a73ed..41a09999d0 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -189,6 +189,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, Dict opt ui->wildmenu_active = false; pmap_put(uint64_t)(&connected_uis, channel_id, ui); + current_ui = channel_id; ui_attach_impl(ui, channel_id); may_trigger_vim_suspend_resume(false); @@ -214,6 +215,7 @@ void nvim_ui_set_focus(uint64_t channel_id, Boolean gained, Error *error) } if (gained) { + current_ui = channel_id; may_trigger_vim_suspend_resume(false); } diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index c103a56032..02aa73d98d 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -359,11 +359,11 @@ void nvim_feedkeys(String keys, String mode, Boolean escape_ks) /// @param keys to be typed /// @return Number of bytes actually written (can be fewer than /// requested if the buffer becomes full). -Integer nvim_input(String keys) +Integer nvim_input(uint64_t channel_id, String keys) FUNC_API_SINCE(1) FUNC_API_FAST { may_trigger_vim_suspend_resume(false); - return (Integer)input_enqueue(keys); + return (Integer)input_enqueue(channel_id, keys); } /// Send mouse event from GUI. @@ -1485,7 +1485,8 @@ Array nvim_get_api_info(uint64_t channel_id, Arena *arena) return rv; } -/// Self-identifies the client. Sets the `client` object returned by |nvim_get_chan_info()|. +/// Self-identifies the client, and sets optional flags on the channel. Defines the `client` object +/// returned by |nvim_get_chan_info()|. /// /// Clients should call this just after connecting, to provide hints for debugging and /// orchestration. (Note: Something is better than nothing! Fields are optional, but at least set |