From 42e5d95cd80e7964e6b681deea633029d7ee4c1c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 11 Jul 2017 09:49:35 +0900 Subject: [PATCH] Preserve order of definition of mappings when listing them Fixes #1479 Closes #1494 --- src/keymap_manager.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/keymap_manager.cc b/src/keymap_manager.cc index 4f332b20..15096933 100644 --- a/src/keymap_manager.cc +++ b/src/keymap_manager.cc @@ -16,7 +16,7 @@ void KeymapManager::map_key(Key key, KeymapMode mode, void KeymapManager::unmap_key(Key key, KeymapMode mode) { - m_mapping.unordered_remove(KeyAndMode{key, mode}); + m_mapping.remove(KeyAndMode{key, mode}); } @@ -43,11 +43,9 @@ KeymapManager::KeyList KeymapManager::get_mapped_keys(KeymapMode mode) const res = m_parent->get_mapped_keys(mode); for (auto& map : m_mapping) { - if (map.key.second == mode) + if (map.key.second == mode and not contains(res, map.key.first)) res.emplace_back(map.key.first); } - std::sort(res.begin(), res.end()); - res.erase(std::unique(res.begin(), res.end()), res.end()); return res; }