diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-10-20 22:18:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-20 22:18:26 +0800 |
commit | 9b8907d90508d7b66f025bbd1f5a48a78c5ce035 (patch) | |
tree | 28ba9bba6705cf19f8f3279c6b0b3ade41c81f4c /runtime | |
parent | dff684fdb3d2e787ac6d6fd49ec52ede604fd0ce (diff) | |
download | rneovim-9b8907d90508d7b66f025bbd1f5a48a78c5ce035.tar.gz rneovim-9b8907d90508d7b66f025bbd1f5a48a78c5ce035.tar.bz2 rneovim-9b8907d90508d7b66f025bbd1f5a48a78c5ce035.zip |
feat(float): allow enabling mouse for non-focusable window (#30844)
Problem: Cannot allow mouse interaction for non-focusable float window.
Solution: Add a "mouse" field to float window config.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/api.txt | 8 | ||||
-rw-r--r-- | runtime/doc/news.txt | 2 | ||||
-rw-r--r-- | runtime/doc/ui.txt | 7 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/api.lua | 7 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/api_keysets.lua | 1 |
5 files changed, 20 insertions, 5 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index dee0324a5b..c77f38a693 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -3195,7 +3195,13 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* be fractional. • focusable: Enable focus by user actions (wincmds, mouse events). Defaults to true. Non-focusable windows can be - entered by |nvim_set_current_win()|. + entered by |nvim_set_current_win()|, or, when the `mouse` + field is set to true, by mouse events. + • mouse: Specify how this window interacts with mouse + events. Defaults to `focusable` value. + • If false, mouse events pass through this window. + • If true, mouse events interact with this window + normally. • external: GUI should display the window as an external top-level window. Currently accepts no other positioning configuration together with this. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index def66a0773..56104d9fdb 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -40,6 +40,8 @@ API This is not expected to break clients because there are no known clients that actually use the `return_type` field or the parameter type names reported by |--api-info| or |nvim_get_api_info()|. +• |nvim_open_win()| supports a `mouse` field that allows configuring mouse + interaction with the window separately from `focusable` field. • Renamed `nvim__id_dictionary` (unsupported/experimental API) to `nvim__id_dict`. diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index d37cdfb9df..cb057a8fd2 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -610,11 +610,12 @@ tabs. size). If the window was previously hidden, it should now be shown again. -["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, focusable, zindex] ~ +["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, mouse_enabled, zindex] ~ Display or reconfigure floating window `win`. The window should be displayed above another grid `anchor_grid` at the specified position - `anchor_row` and `anchor_col`. For the meaning of `anchor` and more - details of positioning, see |nvim_open_win()|. + `anchor_row` and `anchor_col`. For the meaning of `anchor` and more details + of positioning, see |nvim_open_win()|. `mouse_enabled` is true if the + window can receive mouse events. ["win_external_pos", grid, win] ~ Display or reconfigure external window `win`. The window should be diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index c66b295d3a..8236cc7cf0 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1767,7 +1767,12 @@ function vim.api.nvim_open_term(buffer, opts) end --- fractional. --- - focusable: Enable focus by user actions (wincmds, mouse events). --- Defaults to true. Non-focusable windows can be entered by ---- `nvim_set_current_win()`. +--- `nvim_set_current_win()`, or, when the `mouse` field is set to true, +--- by mouse events. +--- - mouse: Specify how this window interacts with mouse events. +--- Defaults to `focusable` value. +--- - If false, mouse events pass through this window. +--- - If true, mouse events interact with this window normally. --- - external: GUI should display the window as an external --- top-level window. Currently accepts no other positioning --- configuration together with this. diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua index 2fe5c32faf..bf184dee2d 100644 --- a/runtime/lua/vim/_meta/api_keysets.lua +++ b/runtime/lua/vim/_meta/api_keysets.lua @@ -295,6 +295,7 @@ error('Cannot require a meta file') --- @field bufpos? any[] --- @field external? boolean --- @field focusable? boolean +--- @field mouse? boolean --- @field vertical? boolean --- @field zindex? integer --- @field border? any |