diff options
Diffstat (limited to 'src/json_ui.cc')
| -rw-r--r-- | src/json_ui.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/json_ui.cc b/src/json_ui.cc index 01768897..7f645605 100644 --- a/src/json_ui.cc +++ b/src/json_ui.cc @@ -8,6 +8,7 @@ #include "keys.hh" #include "ranges.hh" #include "string_utils.hh" +#include "format.hh" #include <cstdio> #include <utility> @@ -39,6 +40,7 @@ String to_json(Attribute attributes) attrs[] { { Attribute::Underline, "underline" }, { Attribute::CurlyUnderline, "curly_underline" }, + { Attribute::DoubleUnderline, "double_underline" }, { Attribute::Reverse, "reverse" }, { Attribute::Blink, "blink" }, { Attribute::Bold, "bold" }, @@ -282,12 +284,12 @@ void JsonUI::eval_json(const Value& json) } else if (method == "scroll") { - if (params.size() != 1) - throw invalid_rpc_request("scroll needs an amount"); - else if (not params[0].is_a<int>()) - throw invalid_rpc_request("scroll amount is not an integer"); - m_on_key({Key::Modifiers::Scroll, (Codepoint)params[0].as<int>()}); - + if (params.size() != 3) + throw invalid_rpc_request("scroll needs an amount and coordinates"); + else if (not params[0].is_a<int>() or not params[1].is_a<int>() or not params[2].is_a<int>()) + throw invalid_rpc_request("scroll parameters are not integers"); + m_on_key({Key::Modifiers::Scroll | (Key::Modifiers)(params[0].as<int>() << 16), + encode_coord({params[1].as<int>(), params[2].as<int>()})}); } else if (method == "menu_select") { |
