From 7af2b9931789735c7f955a410f060a342ebd2d98 Mon Sep 17 00:00:00 2001 From: Chris Webb Date: Wed, 6 Dec 2023 17:35:46 +0000 Subject: [PATCH] Hide empty and undocumented mappings from autoinfo Users who rebind default keys and unmap the originals by binding them to empty strings with empty docstrings end up with empty lines in the autoinfo. For example, https://github.com/mawww/kakoune/issues/4918. Hide completely null bindings which have both an empty mapping and an empty docstring in the autoinfo, as an easy mechanism for these users to eliminate the UI noise. Fixes https://github.com/mawww/kakoune/issues/4918 --- src/normal.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/normal.cc b/src/normal.cc index e70d0680..019ed58a 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -193,6 +193,8 @@ String build_autoinfo_for_mapping(const Context& context, KeymapMode mode, for (auto& key : keymaps.get_mapped_keys(mode)) { const String& docstring = keymaps.get_mapping_docstring(key, mode); + if (keymaps.get_mapping_keys(key, mode).empty() and docstring.empty()) + continue; if (auto it = find_if(descs, [&](auto& elem) { return elem.second == docstring; }); it != descs.end()) it->first += ',' + to_string(key);