[gedit-code-assistance] Scroll cursor in view when moving to refs
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-code-assistance] Scroll cursor in view when moving to refs
- Date: Sun, 13 Nov 2011 17:07:33 +0000 (UTC)
commit 8d5b0fe36648d748f3734ebcb4375215d1462ffc
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Sun Nov 13 18:07:26 2011 +0100
Scroll cursor in view when moving to refs
src/gcp-view.vala | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/gcp-view.vala b/src/gcp-view.vala
index a888e40..17e61ee 100644
--- a/src/gcp-view.vala
+++ b/src/gcp-view.vala
@@ -69,6 +69,20 @@ class View : Object
}
}
+ private void scroll_in_view(TextIter iter)
+ {
+ Gdk.Rectangle vrect;
+ Gdk.Rectangle irect;
+
+ d_view.get_visible_rect(out vrect);
+ d_view.get_iter_location(iter, out irect);
+
+ if (irect.y < vrect.y || irect.y + irect.height > vrect.y + vrect.height)
+ {
+ d_view.scroll_to_iter(iter, 0, true, 0, 0.5);
+ }
+ }
+
private void move_cursor_to_semantic_value(SemanticValue? val)
{
if (val == null)
@@ -92,6 +106,7 @@ class View : Object
}
d_buffer.select_range(start, end);
+ scroll_in_view(start);
}
[Signal(action = true)]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]