Browse Source

Getting ready to add spellcheck in comments using aspell library.

merge-requests/365/head
eidheim 10 years ago
parent
commit
25ef8f8610
  1. 2
      src/notebook.cc
  2. 20
      src/source.cc
  3. 2
      src/source.h

2
src/notebook.cc

@ -67,7 +67,7 @@ void Notebook::open(const boost::filesystem::path &file_path) {
else else
Singleton::terminal()->print("Error: could not find project path for "+file_path.string()+"\n"); Singleton::terminal()->print("Error: could not find project path for "+file_path.string()+"\n");
} }
source_views.emplace_back(new Source::ClangView(file_path, project_path)); source_views.emplace_back(new Source::ClangView(file_path, project_path, language));
} }
else else
source_views.emplace_back(new Source::GenericView(file_path, language)); source_views.emplace_back(new Source::GenericView(file_path, language));

20
src/source.cc

@ -97,6 +97,19 @@ Source::View::View(const boost::filesystem::path &file_path): file_path(file_pat
tab+=tab_char; tab+=tab_char;
tabs_regex=std::regex(std::string("^(")+tab_char+"*)(.*)$"); tabs_regex=std::regex(std::string("^(")+tab_char+"*)(.*)$");
get_buffer()->signal_changed().connect([this](){
auto iter=get_buffer()->get_insert()->get_iter();
if(iter.backward_char()) {
auto context_iter=iter;
if(context_iter.backward_char()) {
if(get_source_buffer()->iter_has_context_class(context_iter, "comment")) {
//TODO: get word, and spellcheck
//cout << "comment: " << (char)*iter << endl;
}
}
}
});
} }
void Source::View::search_occurrences_updated(GtkWidget* widget, GParamSpec* property, gpointer data) { void Source::View::search_occurrences_updated(GtkWidget* widget, GParamSpec* property, gpointer data) {
@ -1394,7 +1407,12 @@ Source::ClangViewAutocomplete(file_path, project_path) {
}; };
} }
Source::ClangView::ClangView(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path): ClangViewRefactor(file_path, project_path) { Source::ClangView::ClangView(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path, Glib::RefPtr<Gsv::Language> language): ClangViewRefactor(file_path, project_path) {
if(language) {
get_source_buffer()->set_highlight_syntax(false);
get_source_buffer()->set_language(language);
}
do_delete_object.connect([this](){ do_delete_object.connect([this](){
if(delete_thread.joinable()) if(delete_thread.joinable())
delete_thread.join(); delete_thread.join();

2
src/source.h

@ -184,7 +184,7 @@ namespace Source {
class ClangView : public ClangViewRefactor { class ClangView : public ClangViewRefactor {
public: public:
ClangView(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path); ClangView(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path, Glib::RefPtr<Gsv::Language> language);
void async_delete(); void async_delete();
bool restart_parse(); bool restart_parse();
private: private:

Loading…
Cancel
Save