[regexxer] Fix the scrolling when working on big files



commit 219670cbd3fda871f1c390d8ee5ba3ce8563b1a6
Author: Fabien Parent <parent f gmail com>
Date:   Sat Jul 16 15:22:25 2011 +0200

    Fix the scrolling when working on big files

 src/mainwindow.cc |    9 ++++++++-
 src/mainwindow.h  |    2 ++
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index b571ee3..8cd4b26 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -783,13 +783,20 @@ void MainWindow::on_go_next_file(bool move_forward)
   on_go_next(move_forward);
 }
 
+bool MainWindow::do_scroll(const Glib::RefPtr<Gtk::TextMark> mark)
+{
+  textview_->scroll_to(mark, 0.125);
+  return false;
+}
+
 void MainWindow::on_go_next(bool move_forward)
 {
   if (const FileBufferPtr buffer = FileBufferPtr::cast_static(textview_->get_buffer()))
   {
     if (const Glib::RefPtr<Gtk::TextMark> mark = buffer->get_next_match(move_forward))
     {
-      textview_->scroll_to(mark, 0.125);
+      Glib::signal_idle ().connect (sigc::bind<const Glib::RefPtr<Gtk::TextMark> >
+            (sigc::mem_fun (*this, &MainWindow::do_scroll), mark));
       statusline_->set_match_index(buffer->get_match_index());
       return;
     }
diff --git a/src/mainwindow.h b/src/mainwindow.h
index b02951f..74355d2 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -168,6 +168,8 @@ private:
   void on_bound_state_changed();
   void on_buffer_modified_changed();
 
+  bool do_scroll(const Glib::RefPtr<Gtk::TextMark> mark);
+
   void on_go_next_file(bool move_forward);
   void on_go_next(bool move_forward);
   void on_replace();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]