Tweak keymap_manager style, fix missing move

This commit is contained in:
Maxime Coste 2014-12-17 13:20:48 +00:00
parent ebecd60eb8
commit e0c452adb6
2 changed files with 4 additions and 4 deletions

View File

@ -6,9 +6,9 @@
namespace Kakoune namespace Kakoune
{ {
void KeymapManager::map_key(Key key, KeymapMode mode, std::vector<Key> mapping) void KeymapManager::map_key(Key key, KeymapMode mode, KeyList mapping)
{ {
m_mapping[{key, mode}] = mapping; m_mapping[{key, mode}] = std::move(mapping);
} }
void KeymapManager::unmap_key(Key key, KeymapMode mode) void KeymapManager::unmap_key(Key key, KeymapMode mode)

View File

@ -29,7 +29,8 @@ class KeymapManager
public: public:
KeymapManager(KeymapManager& parent) : m_parent(&parent) {} KeymapManager(KeymapManager& parent) : m_parent(&parent) {}
void map_key(Key key, KeymapMode mode, std::vector<Key> mapping); using KeyList = std::vector<Key>;
void map_key(Key key, KeymapMode mode, KeyList mapping);
void unmap_key(Key key, KeymapMode mode); void unmap_key(Key key, KeymapMode mode);
bool is_mapped(Key key, KeymapMode mode) const; bool is_mapped(Key key, KeymapMode mode) const;
@ -42,7 +43,6 @@ private:
KeymapManager* m_parent; KeymapManager* m_parent;
using KeyList = std::vector<Key>;
using KeyAndMode = std::pair<Key, KeymapMode>; using KeyAndMode = std::pair<Key, KeymapMode>;
using Keymap = UnorderedMap<KeyAndMode, KeyList>; using Keymap = UnorderedMap<KeyAndMode, KeyList>;
Keymap m_mapping; Keymap m_mapping;