[gedit-code-assistance] Improved getting source location iters



commit 0c9efbc103a3bf26581a2e0e173a6edcbcb7c617
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Sun Nov 13 19:09:44 2011 +0100

    Improved getting source location iters

 src/gcp-source-location.vala |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/gcp-source-location.vala b/src/gcp-source-location.vala
index ea0980f..132e97a 100644
--- a/src/gcp-source-location.vala
+++ b/src/gcp-source-location.vala
@@ -100,10 +100,27 @@ class SourceLocation : Object, SourceRangeSupport
 
 		if (iter.get_line() != d_line - 1)
 		{
+			if (iter.is_end())
+			{
+				return true;
+			}
+
 			return false;
 		}
 
-		return iter.forward_chars(d_column - 1);
+		if (d_column <= 1)
+		{
+			return true;
+		}
+
+		bool ret = iter.forward_chars(d_column - 1);
+
+		if (!ret && iter.is_end())
+		{
+			ret = true;
+		}
+
+		return ret;
 	}
 
 	public bool buffer_coordinates(TextView view, out Gdk.Rectangle rect)



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