From f468a601d5d6b61586d03a13cf0dafa91424d6c1 Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 6 Oct 2015 10:25:02 +0200 Subject: [PATCH] Now only reparse clang files if a header is saved. --- src/notebook.cc | 10 ++++++---- src/source.cc | 2 +- src/source.h | 1 + src/window.cc | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/notebook.cc b/src/notebook.cc index e6d138a..1feebaf 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -165,10 +165,12 @@ bool Notebook::save(int page, bool reparse_needed) { if(juci::filesystem::write(view->file_path, view->get_buffer())) { if(reparse_needed) { if(auto clang_view=dynamic_cast(view)) { - for(auto a_view: source_views) { - if(auto a_clang_view=dynamic_cast(a_view)) { - if(clang_view!=a_clang_view) - a_clang_view->reparse_needed=true; + if(clang_view->language->get_id()=="chdr" || clang_view->language->get_id()=="cpphdr") { + for(auto a_view: source_views) { + if(auto a_clang_view=dynamic_cast(a_view)) { + if(clang_view!=a_clang_view) + a_clang_view->reparse_needed=true; + } } } } diff --git a/src/source.cc b/src/source.cc index 484f00a..7af245f 100644 --- a/src/source.cc +++ b/src/source.cc @@ -79,7 +79,7 @@ std::string Source::FixIt::string() { ////////////// AspellConfig* Source::View::spellcheck_config=NULL; -Source::View::View(const boost::filesystem::path &file_path, Glib::RefPtr language): file_path(file_path) { +Source::View::View(const boost::filesystem::path &file_path, Glib::RefPtr language): file_path(file_path), language(language) { get_source_buffer()->begin_not_undoable_action(); if(language) { if(juci::filesystem::read_non_utf8(file_path, get_buffer())==-1) diff --git a/src/source.h b/src/source.h index 47a8adb..ce34929 100644 --- a/src/source.h +++ b/src/source.h @@ -98,6 +98,7 @@ namespace Source { void paste(); boost::filesystem::path file_path; + Glib::RefPtr language; std::function()> get_declaration_location; std::function goto_method; diff --git a/src/window.cc b/src/window.cc index ce37895..32a1845 100644 --- a/src/window.cc +++ b/src/window.cc @@ -303,7 +303,7 @@ void Window::create_menu() { } } }); - menu.action_group->add(Gtk::Action::create("SourceApplyFixIts", "Apply Fix Its"), Gtk::AccelKey(menu.key_map["source_apply_fix_its"]), [this]() { + menu.action_group->add(Gtk::Action::create("SourceApplyFixIts", "Apply Fix-Its"), Gtk::AccelKey(menu.key_map["source_apply_fix_its"]), [this]() { if(notebook.get_current_page()!=-1) { if(notebook.get_current_view()->apply_fix_its) { notebook.get_current_view()->apply_fix_its();