Browse Source

Added preference option to disable replacing search entry with selected text

merge-requests/399/head
eidheim 6 years ago
parent
commit
f82b1f947a
  1. 2
      CMakeLists.txt
  2. 1
      src/config.cc
  3. 1
      src/config.h
  4. 1
      src/files.h
  5. 3
      src/window.cc

2
CMakeLists.txt

@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 2.8.8) cmake_minimum_required (VERSION 2.8.8)
project(juci) project(juci)
set(JUCI_VERSION "1.5.0.3") set(JUCI_VERSION "1.5.0.4")
set(CPACK_PACKAGE_NAME "jucipp") set(CPACK_PACKAGE_NAME "jucipp")
set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>") set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>")

1
src/config.cc

@ -173,6 +173,7 @@ void Config::read(const boost::property_tree::ptree &cfg) {
source.show_line_numbers = source_json.get<bool>("show_line_numbers"); source.show_line_numbers = source_json.get<bool>("show_line_numbers");
source.enable_multiple_cursors = source_json.get<bool>("enable_multiple_cursors"); source.enable_multiple_cursors = source_json.get<bool>("enable_multiple_cursors");
source.auto_reload_changed_files = source_json.get<bool>("auto_reload_changed_files"); source.auto_reload_changed_files = source_json.get<bool>("auto_reload_changed_files");
source.search_for_selection = source_json.get<bool>("search_for_selection");
source.clang_format_style = source_json.get<std::string>("clang_format_style"); source.clang_format_style = source_json.get<std::string>("clang_format_style");
source.clang_usages_threads = static_cast<unsigned>(source_json.get<int>("clang_usages_threads")); source.clang_usages_threads = static_cast<unsigned>(source_json.get<int>("clang_usages_threads"));
source.debug_place_cursor_at_stop = source_json.get<bool>("debug_place_cursor_at_stop"); source.debug_place_cursor_at_stop = source_json.get<bool>("debug_place_cursor_at_stop");

1
src/config.h

@ -88,6 +88,7 @@ public:
bool show_line_numbers; bool show_line_numbers;
bool enable_multiple_cursors; bool enable_multiple_cursors;
bool auto_reload_changed_files; bool auto_reload_changed_files;
bool search_for_selection;
std::string clang_format_style; std::string clang_format_style;
unsigned clang_usages_threads; unsigned clang_usages_threads;

1
src/files.h

@ -62,6 +62,7 @@ const std::string default_config_file = R"RAW({
"show_line_numbers": true, "show_line_numbers": true,
"enable_multiple_cursors": false, "enable_multiple_cursors": false,
"auto_reload_changed_files": true, "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_comment": "IndentWidth, AccessModifierOffset and UseTab are set automatically. See http://clang.llvm.org/docs/ClangFormatStyleOptions.html",
"clang_format_style": "ColumnLimit: 0, NamespaceIndentation: All", "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", "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",

3
src/window.cc

@ -1641,8 +1641,9 @@ void Window::search_and_replace_entry() {
}; };
if(auto view = Notebook::get().get_current_view()) { if(auto view = Notebook::get().get_current_view()) {
if(Config::get().source.search_for_selection) {
auto const selected = view->get_selected_text(); auto const selected = view->get_selected_text();
if(!selected.empty()) { if(!selected.empty())
last_search = selected; last_search = selected;
} }
} }

Loading…
Cancel
Save