src/location: support calling `colored_line` when `start_column == 0`
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 1 Dec 2014 20:38:12 +0000 (15:38 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 2 Dec 2014 21:36:42 +0000 (16:36 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/location.nit

index 993ce7d..8ed4428 100644 (file)
@@ -174,7 +174,12 @@ class Location
                while line_end+1 < string.length and string.chars[line_end+1] != '\n' and string.chars[line_end+1] != '\r' do
                        line_end += 1
                end
-               var lstart = string.substring(line_start, l.column_start - 1)
+               var lstart
+               if l.column_start > 0 then
+                       lstart = string.substring(line_start, l.column_start - 1)
+               else
+                       lstart = ""
+               end
                var cend
                if i != l.line_end then
                        cend = line_end - line_start + 1