diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-05-03 22:22:12 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-05-03 22:28:20 +1000 |
| commit | 7325ad216cbecb0d14fdee40cef7cca3e39f8513 (patch) | |
| tree | ad23b0afd3ad24fbf8bde23bcd4bba426d52a046 /src/json_ui.cc | |
| parent | c2637f08d95b03fbe6db5b0f98b28c2a54fd4126 (diff) | |
Add support for explicit menu selection from the UI
the JsonUI now supports a "menu_select(int)" RPC call that should
trigger explicit selection of the provided item index.
As discussed for issue #2019.
Diffstat (limited to 'src/json_ui.cc')
| -rw-r--r-- | src/json_ui.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/json_ui.cc b/src/json_ui.cc index 8629395d..67970a35 100644 --- a/src/json_ui.cc +++ b/src/json_ui.cc @@ -410,6 +410,12 @@ void JsonUI::eval_json(const Value& json) else throw runtime_error(format("invalid mouse event type: {}", type)); } + else if (method == "menu_select") + { + if (params.size() != 1) + throw runtime_error("menu_select needs the item index"); + m_on_key({Key::Modifiers::MenuSelect, (Codepoint)params[0].as<int>()}); + } else if (method == "resize") { if (params.size() != 2) |
