Replace a few loops with ranges
This commit is contained in:
parent
0919679e0d
commit
737807dde2
|
@ -273,12 +273,9 @@ public:
|
||||||
if (not overlaps(display_buffer.range(), range))
|
if (not overlaps(display_buffer.range(), range))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector<Face> faces(m_faces.size());
|
const auto faces = m_faces | transform([&faces = context.context.faces()](auto&& spec) {
|
||||||
for (int f = 0; f < m_faces.size(); ++f)
|
return spec.second.empty() ? Face{} : faces[spec.second];
|
||||||
{
|
}) | gather<Vector<Face>>();
|
||||||
if (not m_faces[f].second.empty())
|
|
||||||
faces[f] = context.context.faces()[m_faces[f].second];
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& matches = get_matches(context.context.buffer(), display_buffer.range(), range);
|
auto& matches = get_matches(context.context.buffer(), display_buffer.range(), range);
|
||||||
kak_assert(matches.size() % m_faces.size() == 0);
|
kak_assert(matches.size() % m_faces.size() == 0);
|
||||||
|
|
10
src/main.cc
10
src/main.cc
|
@ -899,10 +899,6 @@ int main(int argc, char* argv[])
|
||||||
set_signal_handler(SIGINT, [](int){});
|
set_signal_handler(SIGINT, [](int){});
|
||||||
set_signal_handler(SIGCHLD, [](int){});
|
set_signal_handler(SIGCHLD, [](int){});
|
||||||
|
|
||||||
Vector<String> params;
|
|
||||||
for (int i = 1; i < argc; ++i)
|
|
||||||
params.emplace_back(argv[i]);
|
|
||||||
|
|
||||||
const ParameterDesc param_desc{
|
const ParameterDesc param_desc{
|
||||||
SwitchMap{ { "c", { true, "connect to given session" } },
|
SwitchMap{ { "c", { true, "connect to given session" } },
|
||||||
{ "e", { true, "execute argument on client initialisation" } },
|
{ "e", { true, "execute argument on client initialisation" } },
|
||||||
|
@ -936,7 +932,11 @@ int main(int argc, char* argv[])
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (contains(ConstArrayView<char*>{argv+1, (size_t)argc-1}, "--help"_sv))
|
const auto params = ArrayView<char*>{argv+1, argv + argc}
|
||||||
|
| transform([](auto* s) { return String{s}; })
|
||||||
|
| gather<Vector<String>>();
|
||||||
|
|
||||||
|
if (contains(params, "--help"_sv))
|
||||||
return show_usage();
|
return show_usage();
|
||||||
|
|
||||||
ParametersParser parser{params, param_desc};
|
ParametersParser parser{params, param_desc};
|
||||||
|
|
|
@ -167,7 +167,7 @@ String build_autoinfo_for_mapping(Context& context, KeymapMode mode,
|
||||||
{
|
{
|
||||||
String keys = join(built_in.keys |
|
String keys = join(built_in.keys |
|
||||||
filter([&](Key k){ return not keymaps.is_mapped(k, mode); }) |
|
filter([&](Key k){ return not keymaps.is_mapped(k, mode); }) |
|
||||||
transform([](Key k) { return key_to_str(k); }),
|
transform(key_to_str),
|
||||||
',', false);
|
',', false);
|
||||||
if (not keys.empty())
|
if (not keys.empty())
|
||||||
descs.emplace_back(std::move(keys), built_in.docstring);
|
descs.emplace_back(std::move(keys), built_in.docstring);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user