From 7aa3f3f323d42539cf12291bf7b6ef2801759564 Mon Sep 17 00:00:00 2001 From: eidheim Date: Mon, 22 Jun 2020 19:49:16 +0200 Subject: [PATCH] Replaced type Gtk::TextBuffer::iterator with Gtk::TextIter --- src/autocomplete.cpp | 2 +- src/grep.hpp | 2 +- src/notebook.cpp | 6 +++--- src/snippets.cpp | 2 +- src/source.cpp | 2 +- src/source_base.cpp | 10 +++++----- src/source_diff.cpp | 4 ++-- src/source_generic.cpp | 8 ++++---- src/source_language_protocol.cpp | 4 ++-- src/source_spellcheck.cpp | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/autocomplete.cpp b/src/autocomplete.cpp index 9eb0fdd..fc967a7 100644 --- a/src/autocomplete.cpp +++ b/src/autocomplete.cpp @@ -20,7 +20,7 @@ Autocomplete::Autocomplete(Gtk::TextView *view, bool &interactive_completion, gu } }); - view->get_buffer()->signal_mark_set().connect([this](const Gtk::TextBuffer::iterator &iterator, const Glib::RefPtr &mark) { + view->get_buffer()->signal_mark_set().connect([this](const Gtk::TextIter &iterator, const Glib::RefPtr &mark) { if(mark->get_name() == "insert") stop(); }); diff --git a/src/grep.hpp b/src/grep.hpp index 416f720..b62e035 100644 --- a/src/grep.hpp +++ b/src/grep.hpp @@ -21,4 +21,4 @@ public: boost::filesystem::path project_path; std::stringstream output; -}; \ No newline at end of file +}; diff --git a/src/notebook.cpp b/src/notebook.cpp index 2c2e516..8c63967 100644 --- a/src/notebook.cpp +++ b/src/notebook.cpp @@ -339,7 +339,7 @@ bool Notebook::open(const boost::filesystem::path &file_path_, Position position cursor_locations.erase(it); } }; - view->get_buffer()->signal_mark_set().connect([this, view, add_cursor_location](const Gtk::TextBuffer::iterator & /*iter*/, const Glib::RefPtr &mark) { + view->get_buffer()->signal_mark_set().connect([this, view, add_cursor_location](const Gtk::TextIter & /*iter*/, const Glib::RefPtr &mark) { if(mark->get_name() == "insert") { if(disable_next_update_cursor_locations) { disable_next_update_cursor_locations = false; @@ -373,11 +373,11 @@ bool Notebook::open(const boost::filesystem::path &file_path_, Position position add_cursor_location(iter); } }); - view->get_buffer()->signal_insert().connect([this, view, add_cursor_location](const Gtk::TextBuffer::iterator & /*iter*/, const Glib::ustring & /*text*/, int /*bytes*/) { + view->get_buffer()->signal_insert().connect([this, view, add_cursor_location](const Gtk::TextIter & /*iter*/, const Glib::ustring & /*text*/, int /*bytes*/) { if(current_cursor_location == cursor_locations.end() || current_cursor_location->view != view) add_cursor_location(view->get_buffer()->get_insert()->get_iter()); }); - view->get_buffer()->signal_erase().connect([this, view, add_cursor_location](const Gtk::TextBuffer::iterator & /*start*/, const Gtk::TextBuffer::iterator & /*end*/) { + view->get_buffer()->signal_erase().connect([this, view, add_cursor_location](const Gtk::TextIter & /*start*/, const Gtk::TextIter & /*end*/) { if(current_cursor_location == cursor_locations.end() || current_cursor_location->view != view) add_cursor_location(view->get_buffer()->get_insert()->get_iter()); diff --git a/src/snippets.cpp b/src/snippets.cpp index ee3e57d..f1f34f0 100644 --- a/src/snippets.cpp +++ b/src/snippets.cpp @@ -43,4 +43,4 @@ void Snippets::load() { catch(const std::exception &e) { Terminal::get().async_print(std::string("Error: ") + e.what() + "\n", true); } -} \ No newline at end of file +} diff --git a/src/source.cpp b/src/source.cpp index dd19633..d3ce2eb 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -628,7 +628,7 @@ void Source::View::setup_signals() { return false; }); - get_buffer()->signal_mark_set().connect([this](const Gtk::TextBuffer::iterator &iterator, const Glib::RefPtr &mark) { + get_buffer()->signal_mark_set().connect([this](const Gtk::TextIter &iterator, const Glib::RefPtr &mark) { auto mark_name = mark->get_name(); if(get_buffer()->get_has_selection() && mark_name == "selection_bound") diff --git a/src/source_base.cpp b/src/source_base.cpp index 5044616..7cfd910 100644 --- a/src/source_base.cpp +++ b/src/source_base.cpp @@ -181,7 +181,7 @@ Source::BaseView::BaseView(const boost::filesystem::path &file_path, const Glib: extra_cursor_selection = get_buffer()->create_tag(); - get_buffer()->signal_mark_set().connect([this](const Gtk::TextBuffer::iterator &iter, const Glib::RefPtr &mark) { + get_buffer()->signal_mark_set().connect([this](const Gtk::TextIter &iter, const Glib::RefPtr &mark) { if(mark->get_name() == "insert") { keep_clipboard = false; } @@ -1207,7 +1207,7 @@ void Source::BaseView::setup_extra_cursor_signals() { auto last_insert = get_buffer()->create_mark(get_buffer()->get_insert()->get_iter(), false); auto last_selection_bound = get_buffer()->create_mark(get_buffer()->get_selection_bound()->get_iter(), false); - get_buffer()->signal_mark_set().connect([this, last_insert, last_selection_bound](const Gtk::TextBuffer::iterator &iter, const Glib::RefPtr &mark) mutable { + get_buffer()->signal_mark_set().connect([this, last_insert, last_selection_bound](const Gtk::TextIter &iter, const Glib::RefPtr &mark) mutable { auto is_insert = mark->get_name() == "insert"; if(is_insert && !keep_snippet_marks) clear_snippet_marks(); @@ -1253,7 +1253,7 @@ void Source::BaseView::setup_extra_cursor_signals() { } }); - get_buffer()->signal_insert().connect([this](const Gtk::TextBuffer::iterator &iter, const Glib::ustring &text, int bytes) { + get_buffer()->signal_insert().connect([this](const Gtk::TextIter &iter, const Glib::ustring &text, int bytes) { if(enable_multiple_cursors && !extra_cursors.empty()) { enable_multiple_cursors = false; auto offset = iter.get_offset() - get_buffer()->get_insert()->get_iter().get_offset(); @@ -1278,7 +1278,7 @@ void Source::BaseView::setup_extra_cursor_signals() { auto erase_backward_length = std::make_shared(0); auto erase_forward_length = std::make_shared(0); auto erase_selection = std::make_shared(false); - get_buffer()->signal_erase().connect([this, erase_backward_length, erase_forward_length, erase_selection](const Gtk::TextBuffer::iterator &iter_start, const Gtk::TextBuffer::iterator &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 && (!extra_cursors.empty())) { auto insert_offset = get_buffer()->get_insert()->get_iter().get_offset(); *erase_backward_length = insert_offset - iter_start.get_offset(); @@ -1298,7 +1298,7 @@ void Source::BaseView::setup_extra_cursor_signals() { } } }, false); - get_buffer()->signal_erase().connect([this, erase_backward_length, erase_forward_length, erase_selection](const Gtk::TextBuffer::iterator & /*iter_start*/, const Gtk::TextBuffer::iterator & /*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)) { enable_multiple_cursors = false; for(auto &extra_cursor : extra_cursors) { diff --git a/src/source_diff.cpp b/src/source_diff.cpp index 19482df..3a55fb3 100644 --- a/src/source_diff.cpp +++ b/src/source_diff.cpp @@ -118,7 +118,7 @@ void Source::DiffView::configure() { parse_stop = false; monitor_changed = false; - buffer_insert_connection = get_buffer()->signal_insert().connect([this](const Gtk::TextBuffer::iterator &iter, const Glib::ustring &text, int) { + buffer_insert_connection = get_buffer()->signal_insert().connect([this](const Gtk::TextIter &iter, const Glib::ustring &text, int) { //Do not perform git diff if no newline is added and line is already marked as added if(!iter.starts_line() && iter.has_tag(renderer->tag_added)) { bool newline = false; @@ -147,7 +147,7 @@ void Source::DiffView::configure() { }, 250); }, false); - buffer_erase_connection = get_buffer()->signal_erase().connect([this](const Gtk::TextBuffer::iterator &start_iter, const Gtk::TextBuffer::iterator &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 if(start_iter.get_line() == end_iter.get_line() && start_iter.has_tag(renderer->tag_added)) return; diff --git a/src/source_generic.cpp b/src/source_generic.cpp index 54df6ab..e393e74 100644 --- a/src/source_generic.cpp +++ b/src/source_generic.cpp @@ -112,7 +112,7 @@ void Source::GenericView::setup_buffer_words() { } // Remove changed word at insert - get_buffer()->signal_insert().connect([this](const Gtk::TextBuffer::iterator &iter_, const Glib::ustring &text, int bytes) { + get_buffer()->signal_insert().connect([this](const Gtk::TextIter &iter_, const Glib::ustring &text, int bytes) { auto iter = iter_; if(!is_token_char(*iter)) iter.backward_char(); @@ -133,7 +133,7 @@ void Source::GenericView::setup_buffer_words() { }, false); // Add all words between start and end of insert - get_buffer()->signal_insert().connect([this](const Gtk::TextBuffer::iterator &iter, const Glib::ustring &text, int bytes) { + get_buffer()->signal_insert().connect([this](const Gtk::TextIter &iter, const Glib::ustring &text, int bytes) { auto start = iter; auto end = iter; start.backward_chars(text.size()); @@ -151,7 +151,7 @@ void Source::GenericView::setup_buffer_words() { }); // Remove words within text that was removed - get_buffer()->signal_erase().connect([this](const Gtk::TextBuffer::iterator &start_, const Gtk::TextBuffer::iterator &end_) { + get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start_, const Gtk::TextIter &end_) { auto start = start_; auto end = end_; if(!is_token_char(*start)) @@ -171,7 +171,7 @@ void Source::GenericView::setup_buffer_words() { }, false); // Add new word resulting from erased text - get_buffer()->signal_erase().connect([this](const Gtk::TextBuffer::iterator &start_, const Gtk::TextBuffer::iterator & /*end*/) { + get_buffer()->signal_erase().connect([this](const Gtk::TextIter &start_, const Gtk::TextIter & /*end*/) { auto start = start_; if(!is_token_char(*start)) start.backward_char(); diff --git a/src/source_language_protocol.cpp b/src/source_language_protocol.cpp index 6de28ac..51d4b08 100644 --- a/src/source_language_protocol.cpp +++ b/src/source_language_protocol.cpp @@ -1325,13 +1325,13 @@ Source::Offset Source::LanguageProtocolView::get_declaration(const Gtk::TextIter void Source::LanguageProtocolView::setup_signals() { if(capabilities.text_document_sync == LanguageProtocol::Capabilities::TextDocumentSync::incremental) { - get_buffer()->signal_insert().connect([this](const Gtk::TextBuffer::iterator &start, const Glib::ustring &text_, int bytes) { + get_buffer()->signal_insert().connect([this](const Gtk::TextIter &start, const Glib::ustring &text_, int bytes) { 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); - get_buffer()->signal_erase().connect([this](const Gtk::TextBuffer::iterator &start, const Gtk::TextBuffer::iterator &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":""})" + "]"); }, false); } diff --git a/src/source_spellcheck.cpp b/src/source_spellcheck.cpp index b08bc19..3846ece 100644 --- a/src/source_spellcheck.cpp +++ b/src/source_spellcheck.cpp @@ -144,7 +144,7 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path, } }, false); - get_buffer()->signal_mark_set().connect([this](const Gtk::TextBuffer::iterator &iter, const Glib::RefPtr &mark) { + get_buffer()->signal_mark_set().connect([this](const Gtk::TextIter &iter, const Glib::RefPtr &mark) { if(spellcheck_checker == nullptr) return; @@ -182,7 +182,7 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path, } }); - get_buffer()->signal_mark_set().connect([](const Gtk::TextBuffer::iterator &iterator, const Glib::RefPtr &mark) { + get_buffer()->signal_mark_set().connect([](const Gtk::TextIter &iterator, const Glib::RefPtr &mark) { if(mark->get_name() == "insert") { if(SelectionDialog::get()) SelectionDialog::get()->hide();