From 3b5b781c5d10689d675e50889255438ce3e273a7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 25 Nov 2015 20:12:11 +0000 Subject: [PATCH] Reject non ascii register names Fixes #493 --- src/input_handler.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index f4448a05..348e23b7 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -231,9 +231,16 @@ public: else if (key == '"') { on_next_key_with_autoinfo(context(), KeymapMode::None, - [this](Key key, Context&) { + [this](Key key, Context& context) { if (auto cp = key.codepoint()) - m_params.reg = *cp; + { + if (*cp <= 127) + m_params.reg = *cp; + else + context.print_status( + { format("invalid register '{}'", *cp), + get_face("Error") }); + } }, "Enter target register", register_doc); } else