From 9b8907d90508d7b66f025bbd1f5a48a78c5ce035 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 20 Oct 2024 22:18:26 +0800 Subject: 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. --- runtime/doc/api.txt | 8 +++++++- runtime/doc/news.txt | 2 ++ runtime/doc/ui.txt | 7 ++++--- 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'runtime/doc') 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 -- cgit