From 9bc8dcc19d7706625920188e43719a8425232553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Genov=C3=A9s?= Date: Fri, 20 Mar 2020 03:44:43 +0100 Subject: [PATCH] Fix search not scrolling to ocurrences --- apostrophe/search_and_replace.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apostrophe/search_and_replace.py b/apostrophe/search_and_replace.py index 001b2f7..b1b2779 100644 --- a/apostrophe/search_and_replace.py +++ b/apostrophe/search_and_replace.py @@ -152,8 +152,15 @@ class SearchAndReplace: self.active = index % len(self.matches) match = self.matches[self.active] + start_iter = self.textbuffer.get_iter_at_offset(match[0]) end_iter = self.textbuffer.get_iter_at_offset(match[1]) + + # create a mark at the start of the coincidence to scroll to it + mark = self.textbuffer.create_mark(None, start_iter, False) + self.textview.scroller.scroll_to_mark(mark, center=True) + + # select coincidence self.textbuffer.select_range(start_iter, end_iter) def hide(self):