diff --git a/src/notebook.cc b/src/notebook.cc index ab4541d..9a43194 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -243,7 +243,7 @@ bool Notebook::save(int page) { view->get_buffer()->set_modified(false); - Project::on_save(); + Project::on_save(page); JDEBUG("end true"); return true; diff --git a/src/project.cc b/src/project.cc index 76a74ab..f581617 100644 --- a/src/project.cc +++ b/src/project.cc @@ -35,10 +35,10 @@ void Project::save_files(const boost::filesystem::path &path) { } } -void Project::on_save() { - if(Notebook::get().get_current_page()==-1) +void Project::on_save(int page) { + if(page>=Notebook::get().size()) return; - auto view=Notebook::get().get_current_view(); + auto view=Notebook::get().get_view(page); if(view->file_path.filename()=="CMakeLists.txt") { auto build=get_build(view->file_path); if(dynamic_cast(build.get())) { diff --git a/src/project.h b/src/project.h index 285b341..ed8f8f0 100644 --- a/src/project.h +++ b/src/project.h @@ -14,7 +14,7 @@ namespace Project { Gtk::Label &debug_status_label(); void save_files(const boost::filesystem::path &path); - void on_save(); + void on_save(int page); extern boost::filesystem::path debug_last_stop_file_path; extern std::unordered_map run_arguments;