[gedit-code-assistance] Use source range/location iter helper functions



commit da3d5eef7278185470c49ea1eb46c76c1d269e10
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Sun Nov 13 19:10:11 2011 +0100

    Use source range/location iter helper functions

 src/gcp-document.vala |   29 ++---------------------------
 1 files changed, 2 insertions(+), 27 deletions(-)
---
diff --git a/src/gcp-document.vala b/src/gcp-document.vala
index cfdff48..199bfeb 100644
--- a/src/gcp-document.vala
+++ b/src/gcp-document.vala
@@ -120,37 +120,12 @@ class Document : GLib.Object
 
 	private bool source_location(SourceLocation location, out TextIter iter)
 	{
-		d_document.get_iter_at_line(out iter, location.line - 1);
-
-		if (iter.get_line() != location.line - 1)
-		{
-			return false;
-		}
-
-		if (location.column > 1)
-		{
-			TextIter enditer;
-
-			d_document.get_end_iter(out enditer);
-
-			if (!iter.forward_chars(location.column - 1) &&
-			    !iter.equal(enditer))
-			{
-				return false;
-			}
-
-			return iter.get_line() == location.line - 1;
-		}
-		else
-		{
-			return true;
-		}
+		return location.get_iter(d_document, out iter);
 	}
 
 	public bool source_range(SourceRange range, out TextIter start, out TextIter end)
 	{
-		return source_location(range.start, out start) &&
-		       source_location(range.end, out end);
+		return range.get_iters(d_document, out start, out end);
 	}
 
 	public static string? mark_category_for_severity(Diagnostic.Severity severity)



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