Browse Source

update lambdas to new format

pipelines/235045657
Jørgen Lien Sellæg 5 years ago
parent
commit
d518aab030
  1. 3
      src/autocomplete.cpp
  2. 6
      src/directories.cpp
  3. 3
      src/git.cpp
  4. 3
      src/info.cpp
  5. 3
      src/notebook.cpp
  6. 6
      src/project.cpp
  7. 3
      src/selection_dialog.cpp
  8. 12
      src/source.cpp
  9. 9
      src/source_base.cpp
  10. 12
      src/source_clang.cpp
  11. 15
      src/source_diff.cpp
  12. 6
      src/source_generic.cpp
  13. 18
      src/source_language_protocol.cpp
  14. 12
      src/source_spellcheck.cpp

3
src/autocomplete.cpp

@ -31,7 +31,8 @@ Autocomplete::Autocomplete(Gsv::View *view, bool &interactive_completion, guint
return true; return true;
} }
return false; return false;
}, false); },
false);
view->signal_focus_out_event().connect([this](GdkEventFocus *event) { view->signal_focus_out_event().connect([this](GdkEventFocus *event) {
stop(); stop();

6
src/directories.cpp

@ -678,7 +678,8 @@ void Directories::add_or_update_path(const boost::filesystem::path &dir_path, co
if(directories.find(path_and_row->first.string()) != directories.end()) if(directories.find(path_and_row->first.string()) != directories.end())
add_or_update_path(path_and_row->first, path_and_row->second, true); add_or_update_path(path_and_row->first, path_and_row->second, true);
return false; return false;
}, 500); },
500);
} }
}); });
@ -698,7 +699,8 @@ void Directories::add_or_update_path(const boost::filesystem::path &dir_path, co
if(directories.find(path_and_row->first.string()) != directories.end()) if(directories.find(path_and_row->first.string()) != directories.end())
colorize_path(path_and_row->first, false); colorize_path(path_and_row->first, false);
return false; return false;
}, 500); },
500);
} }
}); });
} }

3
src/git.cpp

@ -122,7 +122,8 @@ Git::Repository::Repository(const boost::filesystem::path &path) {
if(monitor_event != Gio::FileMonitorEvent::FILE_MONITOR_EVENT_CHANGES_DONE_HINT) { if(monitor_event != Gio::FileMonitorEvent::FILE_MONITOR_EVENT_CHANGES_DONE_HINT) {
this->clear_saved_status(); this->clear_saved_status();
} }
}, false); },
false);
} }
Git::Repository::~Repository() { Git::Repository::~Repository() {

3
src/info.cpp

@ -29,7 +29,8 @@ void Info::print(const std::string &text) {
timeout_connection = Glib::signal_timeout().connect([this]() { timeout_connection = Glib::signal_timeout().connect([this]() {
hide(); hide();
return false; return false;
}, timeout); },
timeout);
label.set_text(text); label.set_text(text);
show(); show();

3
src/notebook.cpp

@ -621,7 +621,8 @@ void Notebook::toggle_split() {
Glib::signal_timeout().connect([this] { Glib::signal_timeout().connect([this] {
set_position(get_width() / 2); set_position(get_width() / 2);
return false; return false;
}, 200); },
200);
} }
else { else {
for(size_t c = size() - 1; c != static_cast<size_t>(-1); --c) { for(size_t c = size() - 1; c != static_cast<size_t>(-1); --c) {

6
src/project.cpp

@ -972,10 +972,12 @@ void Project::Clang::recreate_build() {
void Project::Markdown::compile_and_run() { void Project::Markdown::compile_and_run() {
if(auto view = Notebook::get().get_current_view()) { if(auto view = Notebook::get().get_current_view()) {
auto command = Config::get().project.markdown_command + ' ' + filesystem::escape_argument(filesystem::get_short_path(view->file_path).string()); auto command = Config::get().project.markdown_command + ' ' + filesystem::escape_argument(filesystem::get_short_path(view->file_path).string());
Terminal::get().async_process(command, "", [command](int exit_status) { Terminal::get().async_process(
command, "", [command](int exit_status) {
if(exit_status == 127) if(exit_status == 127)
Terminal::get().async_print("\e[31mError\e[m: executable not found: " + command + "\n", true); Terminal::get().async_print("\e[31mError\e[m: executable not found: " + command + "\n", true);
}, true); },
true);
} }
} }

3
src/selection_dialog.cpp

@ -47,7 +47,8 @@ SelectionDialogBase::SelectionDialogBase(Gtk::TextView *text_view, const boost::
search_entry.signal_changed().connect([this] { search_entry.signal_changed().connect([this] {
if(on_search_entry_changed) if(on_search_entry_changed)
on_search_entry_changed(search_entry.get_text()); on_search_entry_changed(search_entry.get_text());
}, false); },
false);
list_view_text.set_search_entry(search_entry); list_view_text.set_search_entry(search_entry);

12
src/source.cpp

@ -598,7 +598,8 @@ void Source::View::setup_signals() {
show_diagnostic_tooltips(rectangle); show_diagnostic_tooltips(rectangle);
} }
return false; return false;
}, 100); },
100);
} }
if(clickable_tag_applied) { if(clickable_tag_applied) {
@ -615,7 +616,8 @@ void Source::View::setup_signals() {
apply_clickable_tag(iter); apply_clickable_tag(iter);
clickable_tag_applied = true; clickable_tag_applied = true;
return false; return false;
}, 100); },
100);
} }
auto last_mouse_pos = std::make_pair<int, int>(on_motion_last_x, on_motion_last_y); auto last_mouse_pos = std::make_pair<int, int>(on_motion_last_x, on_motion_last_y);
@ -658,14 +660,16 @@ void Source::View::setup_signals() {
show_diagnostic_tooltips(rectangle); show_diagnostic_tooltips(rectangle);
} }
return false; return false;
}, 500); },
500);
delayed_tag_similar_symbols_connection.disconnect(); delayed_tag_similar_symbols_connection.disconnect();
delayed_tag_similar_symbols_connection = Glib::signal_timeout().connect([this] { delayed_tag_similar_symbols_connection = Glib::signal_timeout().connect([this] {
apply_similar_symbol_tag(); apply_similar_symbol_tag();
similar_symbol_tag_applied = true; similar_symbol_tag_applied = true;
return false; return false;
}, 100); },
100);
if(SelectionDialog::get()) if(SelectionDialog::get())
SelectionDialog::get()->hide(); SelectionDialog::get()->hide();

9
src/source_base.cpp

@ -358,7 +358,8 @@ void Source::BaseView::monitor_file() {
} }
Recursive::f(view); Recursive::f(view);
return false; return false;
}, 1000); },
1000);
} }
}; };
delayed_monitor_changed_connection.disconnect(); delayed_monitor_changed_connection.disconnect();
@ -376,7 +377,8 @@ void Source::BaseView::monitor_file() {
delayed_monitor_changed_connection = Glib::signal_timeout().connect([this]() { delayed_monitor_changed_connection = Glib::signal_timeout().connect([this]() {
check_last_write_time(); check_last_write_time();
return false; return false;
}, 1000); // Has to wait 1 second (std::time_t is in seconds) },
1000); // Has to wait 1 second (std::time_t is in seconds)
} }
}); });
} }
@ -1339,7 +1341,8 @@ void Source::BaseView::setup_extra_cursor_signals() {
*erase_selection = true; *erase_selection = true;
} }
} }
}, false); },
false);
get_buffer()->signal_erase().connect([this, erase_backward_length, erase_forward_length, erase_selection](const Gtk::TextIter & /*iter_start*/, const Gtk::TextIter & /*iter_end*/) { get_buffer()->signal_erase().connect([this, erase_backward_length, erase_forward_length, erase_selection](const Gtk::TextIter & /*iter_start*/, const Gtk::TextIter & /*iter_end*/) {
if(enable_multiple_cursors && (*erase_backward_length != 0 || *erase_forward_length != 0)) { if(enable_multiple_cursors && (*erase_backward_length != 0 || *erase_forward_length != 0)) {
enable_multiple_cursors = false; enable_multiple_cursors = false;

12
src/source_clang.cpp

@ -824,8 +824,10 @@ Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::pa
autocomplete.run(); autocomplete.run();
} }
return false; return false;
}, 500); },
}, false); 500);
},
false);
// Remove argument completions // Remove argument completions
signal_key_press_event().connect([this](GdkEventKey *event) { signal_key_press_event().connect([this](GdkEventKey *event) {
@ -838,7 +840,8 @@ Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::pa
CompletionDialog::get()->hide(); CompletionDialog::get()->hide();
} }
return false; return false;
}, false); },
false);
autocomplete.is_restart_key = [this](guint keyval) { autocomplete.is_restart_key = [this](guint keyval) {
auto iter = get_buffer()->get_insert()->get_iter(); auto iter = get_buffer()->get_insert()->get_iter();
@ -2060,7 +2063,8 @@ void Source::ClangView::full_reparse() {
delayed_full_reparse_connection = Glib::signal_timeout().connect([this] { delayed_full_reparse_connection = Glib::signal_timeout().connect([this] {
full_reparse(); full_reparse();
return false; return false;
}, 100); },
100);
return; return;
} }

15
src/source_diff.cpp

@ -144,8 +144,10 @@ void Source::DiffView::configure() {
delayed_buffer_changed_connection = Glib::signal_timeout().connect([this]() { delayed_buffer_changed_connection = Glib::signal_timeout().connect([this]() {
parse_state = ParseState::starting; parse_state = ParseState::starting;
return false; return false;
}, 250); },
}, false); 250);
},
false);
buffer_erase_connection = get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start_iter, const Gtk::TextIter &end_iter) { buffer_erase_connection = get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start_iter, const Gtk::TextIter &end_iter) {
//Do not perform git diff if start_iter and end_iter is at the same line in addition to the line is tagged added //Do not perform git diff if start_iter and end_iter is at the same line in addition to the line is tagged added
@ -157,8 +159,10 @@ void Source::DiffView::configure() {
delayed_buffer_changed_connection = Glib::signal_timeout().connect([this]() { delayed_buffer_changed_connection = Glib::signal_timeout().connect([this]() {
parse_state = ParseState::starting; parse_state = ParseState::starting;
return false; return false;
}, 250); },
}, false); 250);
},
false);
monitor_changed_connection = repository->monitor->signal_changed().connect([this](const Glib::RefPtr<Gio::File> &file, monitor_changed_connection = repository->monitor->signal_changed().connect([this](const Glib::RefPtr<Gio::File> &file,
const Glib::RefPtr<Gio::File> &, const Glib::RefPtr<Gio::File> &,
@ -171,7 +175,8 @@ void Source::DiffView::configure() {
LockGuard lock(parse_mutex); LockGuard lock(parse_mutex);
diff = nullptr; diff = nullptr;
return false; return false;
}, 500); },
500);
} }
}); });

6
src/source_generic.cpp

@ -130,7 +130,8 @@ void Source::GenericView::setup_buffer_words() {
} }
} }
} }
}, false); },
false);
// Add all words between start and end of insert // Add all words between start and end of insert
get_buffer()->signal_insert().connect([this](const Gtk::TextIter &iter, const Glib::ustring &text, int bytes) { get_buffer()->signal_insert().connect([this](const Gtk::TextIter &iter, const Glib::ustring &text, int bytes) {
@ -168,7 +169,8 @@ void Source::GenericView::setup_buffer_words() {
buffer_words.erase(it); buffer_words.erase(it);
} }
} }
}, false); },
false);
// Add new word resulting from erased text // Add new word resulting from erased text
get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start_, const Gtk::TextIter & /*end*/) { get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start_, const Gtk::TextIter & /*end*/) {

18
src/source_language_protocol.cpp

@ -1404,11 +1404,13 @@ void Source::LanguageProtocolView::setup_signals() {
std::string text = text_; std::string text = text_;
escape_text(text); escape_text(text);
client->write_notification("textDocument/didChange", R"("textDocument":{"uri":")" + this->uri + R"(","version":)" + std::to_string(document_version++) + "},\"contentChanges\":[" + R"({"range":{"start":{"line": )" + std::to_string(start.get_line()) + ",\"character\":" + std::to_string(start.get_line_offset()) + R"(},"end":{"line":)" + std::to_string(start.get_line()) + ",\"character\":" + std::to_string(start.get_line_offset()) + R"(}},"text":")" + text + "\"}" + "]"); client->write_notification("textDocument/didChange", R"("textDocument":{"uri":")" + this->uri + R"(","version":)" + std::to_string(document_version++) + "},\"contentChanges\":[" + R"({"range":{"start":{"line": )" + std::to_string(start.get_line()) + ",\"character\":" + std::to_string(start.get_line_offset()) + R"(},"end":{"line":)" + std::to_string(start.get_line()) + ",\"character\":" + std::to_string(start.get_line_offset()) + R"(}},"text":")" + text + "\"}" + "]");
}, false); },
false);
get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start, const Gtk::TextIter &end) { get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start, const Gtk::TextIter &end) {
client->write_notification("textDocument/didChange", R"("textDocument":{"uri":")" + this->uri + R"(","version":)" + std::to_string(document_version++) + "},\"contentChanges\":[" + R"({"range":{"start":{"line": )" + std::to_string(start.get_line()) + ",\"character\":" + std::to_string(start.get_line_offset()) + R"(},"end":{"line":)" + std::to_string(end.get_line()) + ",\"character\":" + std::to_string(end.get_line_offset()) + R"(}},"text":""})" + "]"); client->write_notification("textDocument/didChange", R"("textDocument":{"uri":")" + this->uri + R"(","version":)" + std::to_string(document_version++) + "},\"contentChanges\":[" + R"({"range":{"start":{"line": )" + std::to_string(start.get_line()) + ",\"character\":" + std::to_string(start.get_line_offset()) + R"(},"end":{"line":)" + std::to_string(end.get_line()) + ",\"character\":" + std::to_string(end.get_line_offset()) + R"(}},"text":""})" + "]");
}, false); },
false);
} }
else if(capabilities.text_document_sync == LanguageProtocol::Capabilities::TextDocumentSync::full) { else if(capabilities.text_document_sync == LanguageProtocol::Capabilities::TextDocumentSync::full) {
get_buffer()->signal_changed().connect([this]() { get_buffer()->signal_changed().connect([this]() {
@ -1460,8 +1462,10 @@ void Source::LanguageProtocolView::setup_autocomplete() {
autocomplete->run(); autocomplete->run();
} }
return false; return false;
}, 500); },
}, false); 500);
},
false);
// Remove argument completions // Remove argument completions
signal_key_press_event().connect([this](GdkEventKey *event) { signal_key_press_event().connect([this](GdkEventKey *event) {
@ -1474,7 +1478,8 @@ void Source::LanguageProtocolView::setup_autocomplete() {
CompletionDialog::get()->hide(); CompletionDialog::get()->hide();
} }
return false; return false;
}, false); },
false);
} }
autocomplete->is_restart_key = [this](guint keyval) { autocomplete->is_restart_key = [this](guint keyval) {
@ -1825,7 +1830,8 @@ void Source::LanguageProtocolView::update_type_coverage() {
--update_type_coverage_retries; --update_type_coverage_retries;
update_type_coverage(); update_type_coverage();
return false; return false;
}, 1000); },
1000);
}); });
} }
return; return;

12
src/source_spellcheck.cpp

@ -20,7 +20,8 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path,
} }
return false; return false;
}, false); },
false);
//The following signal is added in case SpellCheckView is not subclassed //The following signal is added in case SpellCheckView is not subclassed
signal_key_press_event().connect([this](GdkEventKey *event) { signal_key_press_event().connect([this](GdkEventKey *event) {
@ -124,7 +125,8 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path,
get_buffer()->remove_tag(spellcheck_error_tag, begin_no_spellcheck_iter, iter); get_buffer()->remove_tag(spellcheck_error_tag, begin_no_spellcheck_iter, iter);
} }
return false; return false;
}, 1000); },
1000);
}); });
// In case of for instance text paste or undo/redo // In case of for instance text paste or undo/redo
@ -141,7 +143,8 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path,
get_buffer()->remove_tag(spellcheck_error_tag, word.first, word.second); get_buffer()->remove_tag(spellcheck_error_tag, word.first, word.second);
} }
} }
}, false); },
false);
get_buffer()->signal_mark_set().connect([this](const Gtk::TextIter &iter, const Glib::RefPtr<Gtk::TextBuffer::Mark> &mark) { get_buffer()->signal_mark_set().connect([this](const Gtk::TextIter &iter, const Glib::RefPtr<Gtk::TextBuffer::Mark> &mark) {
if(mark->get_name() == "insert") { if(mark->get_name() == "insert") {
@ -178,7 +181,8 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path,
SelectionDialog::get()->show(); SelectionDialog::get()->show();
} }
return false; return false;
}, 500); },
500);
} }
}); });

Loading…
Cancel
Save