diff --git a/src/normal.cc b/src/normal.cc index 86d3d416..4c54ea05 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1298,7 +1298,7 @@ void save_selections(Context& context, NormalParams) { on_next_key_with_autoinfo(context, KeymapMode::None, [](Key key, Context& context) { - if (key.modifiers != Key::Modifiers::None) + if (key.modifiers != Key::Modifiers::None or key == Key::Escape) return; const char reg = key.key; @@ -1317,7 +1317,7 @@ void restore_selections(Context& context, NormalParams) { on_next_key_with_autoinfo(context, KeymapMode::None, [](Key key, Context& context) { - if (key.modifiers != Key::Modifiers::None) + if (key.modifiers != Key::Modifiers::None or key == Key::Escape) return; const char reg = key.key; diff --git a/src/register_manager.cc b/src/register_manager.cc index 27ca47bd..7c174731 100644 --- a/src/register_manager.cc +++ b/src/register_manager.cc @@ -74,6 +74,10 @@ Register& RegisterManager::operator[](StringView reg) Register& RegisterManager::operator[](Codepoint c) { + c = tolower(c); + if (c < 32 or c > 127) + throw runtime_error(format("invalid register name: '{}'", c)); + auto& reg_ptr = m_registers[c]; if (not reg_ptr) reg_ptr.reset(new StaticRegister());