From fc60e2987036051785adbacbb13390361b81cd93 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 18 Feb 2018 20:24:34 +1100 Subject: [PATCH] Small code tweaks regarding user modes --- src/commands.cc | 2 +- src/keymap_manager.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index 974f1eed..51373ff6 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1100,7 +1100,7 @@ const CommandDesc echo_cmd = { } }; -KeymapMode parse_keymap_mode(const String& str, const KeymapManager::UserModeList& user_modes) +KeymapMode parse_keymap_mode(StringView str, const KeymapManager::UserModeList& user_modes) { if (prefix_match("normal", str)) return KeymapMode::Normal; if (prefix_match("insert", str)) return KeymapMode::Insert; diff --git a/src/keymap_manager.cc b/src/keymap_manager.cc index 8c359082..2b560706 100644 --- a/src/keymap_manager.cc +++ b/src/keymap_manager.cc @@ -51,7 +51,7 @@ KeymapManager::KeyList KeymapManager::get_mapped_keys(KeymapMode mode) const return res; } -void KeymapManager::add_user_mode(const String user_mode_name) +void KeymapManager::add_user_mode(String user_mode_name) { auto modes = {"normal", "insert", "prompt", "menu", "goto", "view", "user", "object"}; if (contains(modes, user_mode_name)) @@ -63,7 +63,7 @@ void KeymapManager::add_user_mode(const String user_mode_name) if (contains_that(user_mode_name, [](char c){ return not isalnum(c); })) throw runtime_error(format("invalid mode name: '{}'", user_mode_name)); - m_user_modes.push_back(user_mode_name); + m_user_modes.push_back(std::move(user_mode_name)); } }