From eeadb59f7f805f0d10577624fef57b0b9031a7f5 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 22 Mar 2013 13:42:29 +0100 Subject: [PATCH] eval,exec: -restore-selections become -draft, and restore the buffer as well --- src/commands.cc | 8 ++++---- src/rc/clang.kak | 2 +- src/rc/cpp.kak | 2 +- src/rc/ctags.kak | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index 0d88e597..48eb60c6 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -483,7 +483,7 @@ void declare_option(const CommandParameters& params, Context& context) template void context_wrap(const CommandParameters& params, Context& context, Func func) { - ParametersParser parser(params, { { "client", true }, { "restore-selections", false }}); + ParametersParser parser(params, { { "client", true }, { "draft", false }}); if (parser.positional_count() == 0) throw wrong_argument_count(); @@ -491,11 +491,11 @@ void context_wrap(const CommandParameters& params, Context& context, Func func) ClientManager::instance().get_client_context(parser.option_value("client")) : context; - if (parser.has_option("restore-selections")) + if (parser.has_option("draft")) { Editor& editor = real_context.editor(); - DynamicSelectionList sels(editor.buffer(), editor.selections()); - auto restore_sels = on_scope_end([&]{ editor.select(sels); }); + DynamicSelectionList sels{editor.buffer(), editor.selections()}; + auto restore_sels = on_scope_end([&]{ editor.select(sels); real_context.change_editor(editor); }); func(parser, real_context); } else diff --git a/src/rc/clang.kak b/src/rc/clang.kak index bd2faeac..1c5e76c0 100644 --- a/src/rc/clang.kak +++ b/src/rc/clang.kak @@ -29,7 +29,7 @@ def clang-complete %{ } def clang-enable-autocomplete %{ - hook window InsertIdle .* %{ eval -restore-selections %{ + hook window InsertIdle .* %{ eval -draft %{ exec %sh{ [[ $kak_selection =~ .*(\.|->|::).$ ]] && echo "exec ; echo 'completing...'; clang-complete" } }} diff --git a/src/rc/cpp.kak b/src/rc/cpp.kak index 2848b542..d6af08b0 100644 --- a/src/rc/cpp.kak +++ b/src/rc/cpp.kak @@ -22,7 +22,7 @@ hook global WinSetOption filetype=cpp %~ addfilter -group cpp-filters regex ^(\h+)([^\n]*[^([{]\h*|$) \n \n$1 addfilter -group cpp-filters regex ^(\h*)[^\n]*[([{]\h* \n '\n$1 ' addfilter -group cpp-filters cleanup_whitespaces - hook window InsertEnd .* %{ exec -restore-selections s\h+$d } + hook window InsertEnd .* %{ exec -draft s\h+$d } ~ hook global WinSetOption filetype=(?!cpp).* %{ diff --git a/src/rc/ctags.kak b/src/rc/ctags.kak index 22561df6..12e90cde 100644 --- a/src/rc/ctags.kak +++ b/src/rc/ctags.kak @@ -26,7 +26,7 @@ def -shell-params \ }} def funcinfo %{ - eval -restore-selections %{ + eval -draft %{ exec [(B; %sh{ if [[ "$kak_selection" =~ [a-zA-Z_]+\( ]]; then