From d518aab030150934192c79e81a655d8f1ff4f933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Sverre=20Lien=20Sell=C3=A6g?= Date: Thu, 10 Sep 2020 13:49:14 +0200 Subject: [PATCH] update lambdas to new format --- src/autocomplete.cpp | 3 ++- src/directories.cpp | 6 ++++-- src/git.cpp | 3 ++- src/info.cpp | 3 ++- src/notebook.cpp | 3 ++- src/project.cpp | 10 ++++++---- src/selection_dialog.cpp | 3 ++- src/source.cpp | 12 ++++++++---- src/source_base.cpp | 9 ++++++--- src/source_clang.cpp | 12 ++++++++---- src/source_diff.cpp | 15 ++++++++++----- src/source_generic.cpp | 6 ++++-- src/source_language_protocol.cpp | 18 ++++++++++++------ src/source_spellcheck.cpp | 12 ++++++++---- 14 files changed, 76 insertions(+), 39 deletions(-) diff --git a/src/autocomplete.cpp b/src/autocomplete.cpp index 55d8fc7..0787039 100644 --- a/src/autocomplete.cpp +++ b/src/autocomplete.cpp @@ -31,7 +31,8 @@ Autocomplete::Autocomplete(Gsv::View *view, bool &interactive_completion, guint return true; } return false; - }, false); + }, + false); view->signal_focus_out_event().connect([this](GdkEventFocus *event) { stop(); diff --git a/src/directories.cpp b/src/directories.cpp index e5396fb..d6cd6dd 100644 --- a/src/directories.cpp +++ b/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()) add_or_update_path(path_and_row->first, path_and_row->second, true); 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()) colorize_path(path_and_row->first, false); return false; - }, 500); + }, + 500); } }); } diff --git a/src/git.cpp b/src/git.cpp index 26a6da3..9000403 100644 --- a/src/git.cpp +++ b/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) { this->clear_saved_status(); } - }, false); + }, + false); } Git::Repository::~Repository() { diff --git a/src/info.cpp b/src/info.cpp index 539101a..bd8220a 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -29,7 +29,8 @@ void Info::print(const std::string &text) { timeout_connection = Glib::signal_timeout().connect([this]() { hide(); return false; - }, timeout); + }, + timeout); label.set_text(text); show(); diff --git a/src/notebook.cpp b/src/notebook.cpp index 9e06364..3eaab1c 100644 --- a/src/notebook.cpp +++ b/src/notebook.cpp @@ -621,7 +621,8 @@ void Notebook::toggle_split() { Glib::signal_timeout().connect([this] { set_position(get_width() / 2); return false; - }, 200); + }, + 200); } else { for(size_t c = size() - 1; c != static_cast(-1); --c) { diff --git a/src/project.cpp b/src/project.cpp index 3fe4c86..d48af3e 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -972,10 +972,12 @@ void Project::Clang::recreate_build() { void Project::Markdown::compile_and_run() { 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()); - Terminal::get().async_process(command, "", [command](int exit_status) { - if(exit_status == 127) - Terminal::get().async_print("\e[31mError\e[m: executable not found: " + command + "\n", true); - }, true); + Terminal::get().async_process( + command, "", [command](int exit_status) { + if(exit_status == 127) + Terminal::get().async_print("\e[31mError\e[m: executable not found: " + command + "\n", true); + }, + true); } } diff --git a/src/selection_dialog.cpp b/src/selection_dialog.cpp index d6f312c..7ac3c24 100644 --- a/src/selection_dialog.cpp +++ b/src/selection_dialog.cpp @@ -47,7 +47,8 @@ SelectionDialogBase::SelectionDialogBase(Gtk::TextView *text_view, const boost:: search_entry.signal_changed().connect([this] { if(on_search_entry_changed) on_search_entry_changed(search_entry.get_text()); - }, false); + }, + false); list_view_text.set_search_entry(search_entry); diff --git a/src/source.cpp b/src/source.cpp index 407613a..59877dc 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -598,7 +598,8 @@ void Source::View::setup_signals() { show_diagnostic_tooltips(rectangle); } return false; - }, 100); + }, + 100); } if(clickable_tag_applied) { @@ -615,7 +616,8 @@ void Source::View::setup_signals() { apply_clickable_tag(iter); clickable_tag_applied = true; return false; - }, 100); + }, + 100); } auto last_mouse_pos = std::make_pair(on_motion_last_x, on_motion_last_y); @@ -658,14 +660,16 @@ void Source::View::setup_signals() { show_diagnostic_tooltips(rectangle); } return false; - }, 500); + }, + 500); delayed_tag_similar_symbols_connection.disconnect(); delayed_tag_similar_symbols_connection = Glib::signal_timeout().connect([this] { apply_similar_symbol_tag(); similar_symbol_tag_applied = true; return false; - }, 100); + }, + 100); if(SelectionDialog::get()) SelectionDialog::get()->hide(); diff --git a/src/source_base.cpp b/src/source_base.cpp index 62e41b0..72b1ffc 100644 --- a/src/source_base.cpp +++ b/src/source_base.cpp @@ -358,7 +358,8 @@ void Source::BaseView::monitor_file() { } Recursive::f(view); return false; - }, 1000); + }, + 1000); } }; delayed_monitor_changed_connection.disconnect(); @@ -376,7 +377,8 @@ void Source::BaseView::monitor_file() { delayed_monitor_changed_connection = Glib::signal_timeout().connect([this]() { check_last_write_time(); 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; } } - }, 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*/) { if(enable_multiple_cursors && (*erase_backward_length != 0 || *erase_forward_length != 0)) { enable_multiple_cursors = false; diff --git a/src/source_clang.cpp b/src/source_clang.cpp index f98c456..87c935b 100644 --- a/src/source_clang.cpp +++ b/src/source_clang.cpp @@ -824,8 +824,10 @@ Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::pa autocomplete.run(); } return false; - }, 500); - }, false); + }, + 500); + }, + false); // Remove argument completions signal_key_press_event().connect([this](GdkEventKey *event) { @@ -838,7 +840,8 @@ Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::pa CompletionDialog::get()->hide(); } return false; - }, false); + }, + false); autocomplete.is_restart_key = [this](guint keyval) { 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] { full_reparse(); return false; - }, 100); + }, + 100); return; } diff --git a/src/source_diff.cpp b/src/source_diff.cpp index 22f683a..8044b1e 100644 --- a/src/source_diff.cpp +++ b/src/source_diff.cpp @@ -144,8 +144,10 @@ void Source::DiffView::configure() { delayed_buffer_changed_connection = Glib::signal_timeout().connect([this]() { parse_state = ParseState::starting; 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) { //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]() { parse_state = ParseState::starting; return false; - }, 250); - }, false); + }, + 250); + }, + false); monitor_changed_connection = repository->monitor->signal_changed().connect([this](const Glib::RefPtr &file, const Glib::RefPtr &, @@ -171,7 +175,8 @@ void Source::DiffView::configure() { LockGuard lock(parse_mutex); diff = nullptr; return false; - }, 500); + }, + 500); } }); diff --git a/src/source_generic.cpp b/src/source_generic.cpp index d893cfe..e18d1d1 100644 --- a/src/source_generic.cpp +++ b/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 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); } } - }, false); + }, + false); // Add new word resulting from erased text get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start_, const Gtk::TextIter & /*end*/) { diff --git a/src/source_language_protocol.cpp b/src/source_language_protocol.cpp index 085098d..092e3c2 100644 --- a/src/source_language_protocol.cpp +++ b/src/source_language_protocol.cpp @@ -1404,11 +1404,13 @@ void Source::LanguageProtocolView::setup_signals() { std::string 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 + "\"}" + "]"); - }, false); + }, + false); 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":""})" + "]"); - }, false); + }, + false); } else if(capabilities.text_document_sync == LanguageProtocol::Capabilities::TextDocumentSync::full) { get_buffer()->signal_changed().connect([this]() { @@ -1460,8 +1462,10 @@ void Source::LanguageProtocolView::setup_autocomplete() { autocomplete->run(); } return false; - }, 500); - }, false); + }, + 500); + }, + false); // Remove argument completions signal_key_press_event().connect([this](GdkEventKey *event) { @@ -1474,7 +1478,8 @@ void Source::LanguageProtocolView::setup_autocomplete() { CompletionDialog::get()->hide(); } return false; - }, false); + }, + false); } autocomplete->is_restart_key = [this](guint keyval) { @@ -1825,7 +1830,8 @@ void Source::LanguageProtocolView::update_type_coverage() { --update_type_coverage_retries; update_type_coverage(); return false; - }, 1000); + }, + 1000); }); } return; diff --git a/src/source_spellcheck.cpp b/src/source_spellcheck.cpp index 92f14cb..649c4ee 100644 --- a/src/source_spellcheck.cpp +++ b/src/source_spellcheck.cpp @@ -20,7 +20,8 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path, } return false; - }, false); + }, + false); //The following signal is added in case SpellCheckView is not subclassed 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); } return false; - }, 1000); + }, + 1000); }); // 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); } } - }, false); + }, + false); get_buffer()->signal_mark_set().connect([this](const Gtk::TextIter &iter, const Glib::RefPtr &mark) { if(mark->get_name() == "insert") { @@ -178,7 +181,8 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path, SelectionDialog::get()->show(); } return false; - }, 500); + }, + 500); } });