parent
4b605c582c
commit
661d1a0905
|
@ -190,23 +190,29 @@ String build_autoinfo_for_mapping(const Context& context, KeymapMode mode,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& key : keymaps.get_mapped_keys(mode))
|
for (auto& key : keymaps.get_mapped_keys(mode))
|
||||||
descs.emplace_back(to_string(key),
|
{
|
||||||
keymaps.get_mapping_docstring(key, mode));
|
const String& docstring = keymaps.get_mapping_docstring(key, mode);
|
||||||
|
if (auto it = find_if(descs, [&](auto& elem) { return elem.second == docstring; });
|
||||||
|
it != descs.end())
|
||||||
|
it->first += ',' + to_string(key);
|
||||||
|
else
|
||||||
|
descs.emplace_back(to_string(key), docstring);
|
||||||
|
}
|
||||||
|
|
||||||
auto max_len = 0_col;
|
auto max_len = 0_col;
|
||||||
for (auto& desc : descs)
|
for (auto& [keys, docstring] : descs)
|
||||||
{
|
{
|
||||||
auto len = desc.first.column_length();
|
auto len = keys.column_length();
|
||||||
if (len > max_len)
|
if (len > max_len)
|
||||||
max_len = len;
|
max_len = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
String res;
|
String res;
|
||||||
for (auto& desc : descs)
|
for (auto& [keys, docstring] : descs)
|
||||||
res += format("{}:{}{}\n",
|
res += format("{}:{}{}\n",
|
||||||
desc.first,
|
keys,
|
||||||
String{' ', max_len - desc.first.column_length() + 1},
|
String{' ', max_len - keys.column_length() + 1},
|
||||||
desc.second);
|
docstring);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user