|
|
|
@ -8,8 +8,6 @@ |
|
|
|
#include "filesystem.h" |
|
|
|
#include "filesystem.h" |
|
|
|
#include "terminal.h" |
|
|
|
#include "terminal.h" |
|
|
|
|
|
|
|
|
|
|
|
using namespace std; //TODO: remove
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace sigc { |
|
|
|
namespace sigc { |
|
|
|
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE |
|
|
|
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE |
|
|
|
template <typename Functor> |
|
|
|
template <typename Functor> |
|
|
|
@ -219,7 +217,7 @@ Source::View::View(const boost::filesystem::path &file_path, const boost::filesy |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if(mark->get_name()=="insert") { |
|
|
|
if(mark->get_name()=="insert") { |
|
|
|
if(spellcheck_suggestions_dialog_shown) |
|
|
|
if(spellcheck_suggestions_dialog && spellcheck_suggestions_dialog->shown) |
|
|
|
spellcheck_suggestions_dialog->hide(); |
|
|
|
spellcheck_suggestions_dialog->hide(); |
|
|
|
delayed_spellcheck_suggestions_connection.disconnect(); |
|
|
|
delayed_spellcheck_suggestions_connection.disconnect(); |
|
|
|
delayed_spellcheck_suggestions_connection=Glib::signal_timeout().connect([this]() { |
|
|
|
delayed_spellcheck_suggestions_connection=Glib::signal_timeout().connect([this]() { |
|
|
|
@ -233,9 +231,6 @@ Source::View::View(const boost::filesystem::path &file_path, const boost::filesy |
|
|
|
} |
|
|
|
} |
|
|
|
if(need_suggestions) { |
|
|
|
if(need_suggestions) { |
|
|
|
spellcheck_suggestions_dialog=std::unique_ptr<SelectionDialog>(new SelectionDialog(*this, get_buffer()->create_mark(get_buffer()->get_insert()->get_iter()), false)); |
|
|
|
spellcheck_suggestions_dialog=std::unique_ptr<SelectionDialog>(new SelectionDialog(*this, get_buffer()->create_mark(get_buffer()->get_insert()->get_iter()), false)); |
|
|
|
spellcheck_suggestions_dialog->on_hide=[this](){ |
|
|
|
|
|
|
|
spellcheck_suggestions_dialog_shown=false; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
auto word=spellcheck_get_word(get_buffer()->get_insert()->get_iter()); |
|
|
|
auto word=spellcheck_get_word(get_buffer()->get_insert()->get_iter()); |
|
|
|
auto suggestions=spellcheck_get_suggestions(word.first, word.second); |
|
|
|
auto suggestions=spellcheck_get_suggestions(word.first, word.second); |
|
|
|
if(suggestions.size()==0) |
|
|
|
if(suggestions.size()==0) |
|
|
|
@ -250,7 +245,6 @@ Source::View::View(const boost::filesystem::path &file_path, const boost::filesy |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
spellcheck_suggestions_dialog->show(); |
|
|
|
spellcheck_suggestions_dialog->show(); |
|
|
|
spellcheck_suggestions_dialog_shown=true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}, 500); |
|
|
|
}, 500); |
|
|
|
@ -261,7 +255,7 @@ Source::View::View(const boost::filesystem::path &file_path, const boost::filesy |
|
|
|
set_info(info); |
|
|
|
set_info(info); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
set_tooltip_events(); |
|
|
|
set_tooltip_and_dialog_events(); |
|
|
|
|
|
|
|
|
|
|
|
tab_char=Config::get().source.default_tab_char; |
|
|
|
tab_char=Config::get().source.default_tab_char; |
|
|
|
tab_size=Config::get().source.default_tab_size; |
|
|
|
tab_size=Config::get().source.default_tab_size; |
|
|
|
@ -386,7 +380,7 @@ void Source::View::configure() { |
|
|
|
get_buffer()->remove_tag_by_name("spellcheck_error", get_buffer()->begin(), get_buffer()->end()); |
|
|
|
get_buffer()->remove_tag_by_name("spellcheck_error", get_buffer()->begin(), get_buffer()->end()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Source::View::set_tooltip_events() { |
|
|
|
void Source::View::set_tooltip_and_dialog_events() { |
|
|
|
signal_motion_notify_event().connect([this](GdkEventMotion* event) { |
|
|
|
signal_motion_notify_event().connect([this](GdkEventMotion* event) { |
|
|
|
if(on_motion_last_x!=event->x || on_motion_last_y!=event->y) { |
|
|
|
if(on_motion_last_x!=event->x || on_motion_last_y!=event->y) { |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
@ -442,6 +436,13 @@ void Source::View::set_tooltip_events() { |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
type_tooltips.hide(); |
|
|
|
type_tooltips.hide(); |
|
|
|
diagnostic_tooltips.hide(); |
|
|
|
diagnostic_tooltips.hide(); |
|
|
|
|
|
|
|
delayed_spellcheck_suggestions_connection.disconnect(); |
|
|
|
|
|
|
|
if(spellcheck_suggestions_dialog) |
|
|
|
|
|
|
|
spellcheck_suggestions_dialog->hide(); |
|
|
|
|
|
|
|
if(autocomplete_dialog) |
|
|
|
|
|
|
|
autocomplete_dialog->hide(); |
|
|
|
|
|
|
|
if(selection_dialog) |
|
|
|
|
|
|
|
selection_dialog->hide(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@ -449,6 +450,7 @@ void Source::View::set_tooltip_events() { |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
type_tooltips.hide(); |
|
|
|
type_tooltips.hide(); |
|
|
|
diagnostic_tooltips.hide(); |
|
|
|
diagnostic_tooltips.hide(); |
|
|
|
|
|
|
|
delayed_spellcheck_suggestions_connection.disconnect(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@ -456,6 +458,7 @@ void Source::View::set_tooltip_events() { |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
delayed_tooltips_connection.disconnect(); |
|
|
|
type_tooltips.hide(); |
|
|
|
type_tooltips.hide(); |
|
|
|
diagnostic_tooltips.hide(); |
|
|
|
diagnostic_tooltips.hide(); |
|
|
|
|
|
|
|
delayed_spellcheck_suggestions_connection.disconnect(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -931,7 +934,7 @@ bool Source::View::find_left_bracket_backward(Gtk::TextIter iter, Gtk::TextIter |
|
|
|
|
|
|
|
|
|
|
|
//Basic indentation
|
|
|
|
//Basic indentation
|
|
|
|
bool Source::View::on_key_press_event(GdkEventKey* key) { |
|
|
|
bool Source::View::on_key_press_event(GdkEventKey* key) { |
|
|
|
if(spellcheck_suggestions_dialog_shown) { |
|
|
|
if(spellcheck_suggestions_dialog && spellcheck_suggestions_dialog->shown) { |
|
|
|
if(spellcheck_suggestions_dialog->on_key_press(key)) |
|
|
|
if(spellcheck_suggestions_dialog->on_key_press(key)) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1235,8 +1238,8 @@ std::pair<char, unsigned> Source::View::find_tab_char_and_size() { |
|
|
|
} |
|
|
|
} |
|
|
|
else if(!iter.ends_line()) { |
|
|
|
else if(!iter.ends_line()) { |
|
|
|
if(tab_count!=last_tab_count) |
|
|
|
if(tab_count!=last_tab_count) |
|
|
|
tab_sizes[abs(tab_count-last_tab_count)]++; |
|
|
|
tab_sizes[std::abs(tab_count-last_tab_count)]++; |
|
|
|
last_tab_diff=abs(tab_count-last_tab_count); |
|
|
|
last_tab_diff=std::abs(tab_count-last_tab_count); |
|
|
|
last_tab_count=tab_count; |
|
|
|
last_tab_count=tab_count; |
|
|
|
last_char=0; |
|
|
|
last_char=0; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1290,7 +1293,7 @@ std::pair<char, unsigned> Source::View::find_tab_char_and_size() { |
|
|
|
} |
|
|
|
} |
|
|
|
else if(!iter.ends_line()) { |
|
|
|
else if(!iter.ends_line()) { |
|
|
|
if(tab_count!=last_tab_count) |
|
|
|
if(tab_count!=last_tab_count) |
|
|
|
tab_sizes[abs(tab_count-last_tab_count)]++; |
|
|
|
tab_sizes[std::abs(tab_count-last_tab_count)]++; |
|
|
|
last_tab_count=tab_count; |
|
|
|
last_tab_count=tab_count; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|