4 def __init__(self
, source
, data
, index
, row
, column
):
11 def get_snippet(self
, max_length
=79):
12 if not isinstance(self
.data
, basestring
):
16 while start
> 0 and self
.data
[start
-1] not in '\r\n':
18 if self
.index
-start
> max_length
/2-1:
24 while end
< len(self
.data
) and self
.data
[end
] not in '\r\n':
26 if end
-self
.index
> max_length
/2-1:
30 snippet
= self
.data
[start
:end
]
31 if isinstance(snippet
, unicode):
32 snippet
= snippet
.encode('utf-8')
33 return head
+ snippet
+ tail
+ '\n' \
34 + ' '*(self
.index
-start
+len(head
)) + '^' + '\n'