parent
2fa553e728
commit
8e555cb992
|
@ -49,6 +49,8 @@ Here are the requests that can be written by the json ui on stdout:
|
||||||
mode can be:
|
mode can be:
|
||||||
- prompt: the coordinate line should be 0, and the cursor is in the prompt area
|
- prompt: the coordinate line should be 0, and the cursor is in the prompt area
|
||||||
- buffer: the cursor is in the buffer display area
|
- buffer: the cursor is in the buffer display area
|
||||||
|
* set_ui_options(Map<String, String> options)
|
||||||
|
called when ui_options changed with a map of options name to option values
|
||||||
* refresh(bool force)
|
* refresh(bool force)
|
||||||
|
|
||||||
The requests that the json ui can interpret on stdin are:
|
The requests that the json ui can interpret on stdin are:
|
||||||
|
|
|
@ -20,19 +20,19 @@ namespace Kakoune
|
||||||
template<typename T>
|
template<typename T>
|
||||||
String to_json(ArrayView<const T> array)
|
String to_json(ArrayView<const T> array)
|
||||||
{
|
{
|
||||||
String res;
|
return "[" + join(array | transform([](auto&& elem) { return to_json(elem); }), ',', false) + "]";
|
||||||
for (auto& elem : array)
|
|
||||||
{
|
|
||||||
if (not res.empty())
|
|
||||||
res += ", ";
|
|
||||||
res += to_json(elem);
|
|
||||||
}
|
|
||||||
return "[" + res + "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, MemoryDomain D>
|
template<typename T, MemoryDomain D>
|
||||||
String to_json(const Vector<T, D>& vec) { return to_json(ArrayView<const T>{vec}); }
|
String to_json(const Vector<T, D>& vec) { return to_json(ArrayView<const T>{vec}); }
|
||||||
|
|
||||||
|
template<typename K, typename V, MemoryDomain D>
|
||||||
|
String to_json(const HashMap<K, V, D>& map)
|
||||||
|
{
|
||||||
|
return "{" + join(map | transform([](auto&& i) { return format("{}: {}", to_json(i.key), to_json(i.value)); }),
|
||||||
|
',', false) + "}";
|
||||||
|
}
|
||||||
|
|
||||||
String to_json(int i) { return to_string(i); }
|
String to_json(int i) { return to_string(i); }
|
||||||
String to_json(bool b) { return b ? "true" : "false"; }
|
String to_json(bool b) { return b ? "true" : "false"; }
|
||||||
String to_json(StringView str)
|
String to_json(StringView str)
|
||||||
|
@ -232,7 +232,7 @@ void JsonUI::refresh(bool force)
|
||||||
|
|
||||||
void JsonUI::set_ui_options(const Options& options)
|
void JsonUI::set_ui_options(const Options& options)
|
||||||
{
|
{
|
||||||
// rpc_call("set_ui_options", options);
|
rpc_call("set_ui_options", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayCoord JsonUI::dimensions()
|
DisplayCoord JsonUI::dimensions()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user