Browse Source

Added preferences item debug_place_cursor_at_stop to update cursor when the debugger stops as suggested in #252

merge-requests/399/head
eidheim 6 years ago
parent
commit
c0e4376b27
  1. 2
      CMakeLists.txt
  2. 1
      src/config.cc
  3. 2
      src/config.h
  4. 3
      src/files.h
  5. 9
      src/project.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") set(JUCI_VERSION "1.5.0.1")
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

@ -175,6 +175,7 @@ void Config::read(const boost::property_tree::ptree &cfg) {
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.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");
auto pt_doc_search = cfg.get_child("documentation_searches"); auto pt_doc_search = cfg.get_child("documentation_searches");
for(auto &pt_doc_search_lang : pt_doc_search) { for(auto &pt_doc_search_lang : pt_doc_search) {
source.documentation_searches[pt_doc_search_lang.first].separator = pt_doc_search_lang.second.get<std::string>("separator"); source.documentation_searches[pt_doc_search_lang.first].separator = pt_doc_search_lang.second.get<std::string>("separator");

2
src/config.h

@ -92,6 +92,8 @@ public:
std::string clang_format_style; std::string clang_format_style;
unsigned clang_usages_threads; unsigned clang_usages_threads;
bool debug_place_cursor_at_stop;
std::unordered_map<std::string, DocumentationSearch> documentation_searches; std::unordered_map<std::string, DocumentationSearch> documentation_searches;
}; };

3
src/files.h

@ -65,7 +65,8 @@ const std::string default_config_file = R"RAW({
"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",
"clang_usages_threads": -1 "clang_usages_threads": -1,
"debug_place_cursor_at_stop": false
}, },
"terminal": { "terminal": {
"history_size": 1000, "history_size": 1000,

9
src/project.cc

@ -447,7 +447,14 @@ void Project::LLDB::debug_start() {
Project::debug_stop.second.first = stop_line; Project::debug_stop.second.first = stop_line;
Project::debug_stop.second.second = stop_column; Project::debug_stop.second.second = stop_column;
debug_update_stop(); debug_update_stop();
if(auto view = Notebook::get().get_current_view())
if(Config::get().source.debug_place_cursor_at_stop && !stop_path.empty()) {
Notebook::get().open(stop_path);
auto view = Notebook::get().get_current_view();
view->place_cursor_at_line_index(stop_line, stop_column);
view->scroll_to_cursor_delayed(view, true, false);
}
else if(auto view = Notebook::get().get_current_view())
view->get_buffer()->place_cursor(view->get_buffer()->get_insert()->get_iter()); view->get_buffer()->place_cursor(view->get_buffer()->get_insert()->get_iter());
}); });
}); });

Loading…
Cancel
Save