diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b5f47d..a7c20af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.8.8) project(juci) -set(JUCI_VERSION "1.5.0.3") +set(JUCI_VERSION "1.5.0.4") set(CPACK_PACKAGE_NAME "jucipp") set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim ") diff --git a/src/config.cc b/src/config.cc index bc19c00..0441a19 100644 --- a/src/config.cc +++ b/src/config.cc @@ -173,6 +173,7 @@ void Config::read(const boost::property_tree::ptree &cfg) { source.show_line_numbers = source_json.get("show_line_numbers"); source.enable_multiple_cursors = source_json.get("enable_multiple_cursors"); source.auto_reload_changed_files = source_json.get("auto_reload_changed_files"); + source.search_for_selection = source_json.get("search_for_selection"); source.clang_format_style = source_json.get("clang_format_style"); source.clang_usages_threads = static_cast(source_json.get("clang_usages_threads")); source.debug_place_cursor_at_stop = source_json.get("debug_place_cursor_at_stop"); diff --git a/src/config.h b/src/config.h index eab7db4..1eb8765 100644 --- a/src/config.h +++ b/src/config.h @@ -88,6 +88,7 @@ public: bool show_line_numbers; bool enable_multiple_cursors; bool auto_reload_changed_files; + bool search_for_selection; std::string clang_format_style; unsigned clang_usages_threads; diff --git a/src/files.h b/src/files.h index 48b1fd1..141fa06 100644 --- a/src/files.h +++ b/src/files.h @@ -62,6 +62,7 @@ const std::string default_config_file = R"RAW({ "show_line_numbers": true, "enable_multiple_cursors": false, "auto_reload_changed_files": true, + "search_for_selection": true, "clang_format_style_comment": "IndentWidth, AccessModifierOffset and UseTab are set automatically. See http://clang.llvm.org/docs/ClangFormatStyleOptions.html", "clang_format_style": "ColumnLimit: 0, NamespaceIndentation: All", "clang_usages_threads_comment": "The number of threads used in finding usages in unparsed files. -1 corresponds to the number of cores available, and 0 disables the search", diff --git a/src/window.cc b/src/window.cc index 9c51aaf..6867d88 100644 --- a/src/window.cc +++ b/src/window.cc @@ -1641,9 +1641,10 @@ void Window::search_and_replace_entry() { }; if(auto view = Notebook::get().get_current_view()) { - auto const selected = view->get_selected_text(); - if(!selected.empty()) { - last_search = selected; + if(Config::get().source.search_for_selection) { + auto const selected = view->get_selected_text(); + if(!selected.empty()) + last_search = selected; } } EntryBox::get().entries.emplace_back(last_search, [](const std::string &content) {