replace with char only replaces when entered character is printable

This commit is contained in:
Maxime Coste 2013-07-02 14:03:20 +01:00
parent c1b2f7ef6a
commit 6484fead0c

View File

@ -201,6 +201,8 @@ void view_commands(Context& context)
void replace_with_char(Context& context) void replace_with_char(Context& context)
{ {
context.input_handler().on_next_key([](const Key& key, Context& context) { context.input_handler().on_next_key([](const Key& key, Context& context) {
if (not isprint(key.key))
return;
Editor& editor = context.editor(); Editor& editor = context.editor();
SelectionList sels = editor.selections(); SelectionList sels = editor.selections();
auto restore_sels = on_scope_end([&]{ editor.select(std::move(sels)); }); auto restore_sels = on_scope_end([&]{ editor.select(std::move(sels)); });