- this.searchcontext.forward(beg, out st, out en);
- this.last_search_end = en.get_offset();
-
- this.sourceview.el.grab_focus();
- buf.place_cursor(st);
- this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
-
+ if (!this.searchcontext.forward(beg, out st, out en)) {
+ this.last_search_end = 0;
+ } else {
+ this.last_search_end = en.get_offset();
+ if (change_focus) {
+ this.sourceview.el.grab_focus();
+ }
+ buf.place_cursor(st);
+ var ln = st.get_line();
+ buf.get_iter_at_line(out stl,ln);
+
+ this.sourceview.el.scroll_to_iter(stl, 0.0f, true, 0.0f, 0.5f);
+ }