diff --git a/src/config.cc b/src/config.cc index a50ade1..422e567 100644 --- a/src/config.cc +++ b/src/config.cc @@ -20,7 +20,7 @@ void MainConfig::read() { retrieve_config(); } catch(const std::exception &e) { - Singleton::terminal()->print("Error reading "+config_json + "config.json: "+e.what()+"\n"); + Singleton::terminal()->print("Error reading "+config_json+": "+e.what()+"\n"); std::stringstream ss; ss << configjson; boost::property_tree::read_json(ss, cfg); @@ -71,6 +71,7 @@ void MainConfig::retrieve_config() { Singleton::Config::window()->default_size = {cfg.get("default_window_size.width"), cfg.get("default_window_size.height")}; Singleton::Config::terminal()->make_command=cfg.get("project.make_command"); Singleton::Config::terminal()->cmake_command=cfg.get("project.cmake_command"); + Singleton::Config::terminal()->clang_format_command=cfg.get("project.clang_format_command", "clang-format"); Singleton::Config::terminal()->history_size=cfg.get("terminal_history_size"); } @@ -162,6 +163,8 @@ void MainConfig::GenerateDirectoryFilter() { boost::property_tree::ptree dir_json = cfg.get_child("directoryfilter"); boost::property_tree::ptree ignore_json = dir_json.get_child("ignore"); boost::property_tree::ptree except_json = dir_json.get_child("exceptions"); + dir_cfg->exceptions.clear(); + dir_cfg->ignored.clear(); for ( auto &i : except_json ) dir_cfg->exceptions.emplace_back(i.second.get_value()); for ( auto &i : ignore_json ) diff --git a/src/source_clang.cc b/src/source_clang.cc index 533d7e7..b47a7ac 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -924,7 +924,7 @@ Source::ClangViewAutocomplete(file_path, project_path, language) { }); auto_indent=[this]() { - std::string command="clang-format"; + auto command=Singleton::Config::terminal()->clang_format_command; unsigned indent_width; std::string tab_style; if(tab_char=='\t') { diff --git a/src/terminal.h b/src/terminal.h index dcd0da9..526fa3f 100644 --- a/src/terminal.h +++ b/src/terminal.h @@ -16,6 +16,7 @@ public: public: std::string cmake_command; std::string make_command; + std::string clang_format_command; int history_size; }; diff --git a/src/window.cc b/src/window.cc index c1a4d56..993e942 100644 --- a/src/window.cc +++ b/src/window.cc @@ -132,7 +132,9 @@ void Window::configure() { auto css_provider = Gtk::CssProvider::get_named(Singleton::Config::window()->theme_name, Singleton::Config::window()->theme_variant); //TODO: add check if theme exists, or else write error to Singleton::terminal() style_context->add_provider_for_screen(screen, css_provider, GTK_STYLE_PROVIDER_PRIORITY_SETTINGS); - + if(Singleton::directories() != nullptr) { + Singleton::directories()->update(); + } Singleton::menu()->set_keys(); }