@@ -272,35 +272,46 @@ def charsUntil(self, characters, opposite = False):
272
272
#If the queue doesn't grow we have reached EOF
273
273
if i == len (self .queue ) or self .queue [i ] is EOF :
274
274
break
275
+ #XXX- wallpaper over bug in calculation below
276
+ #Otherwise change the stream position
277
+ if self .queue [i ] == '\n ' :
278
+ self .lineLengths .append (self .col )
279
+ self .line += 1
280
+ self .col = 0
281
+ else :
282
+ self .col += 1
275
283
276
284
rv = u"" .join (self .queue [:i ])
285
+ self .queue = self .queue [i :]
277
286
278
287
#Calculate where we now are in the stream
279
288
#One possible optimisation would be to store all read characters and
280
289
#Calculate this on an as-needed basis (perhaps flushing the read data
281
290
#every time we read a new chunk) rather than once per call here and
282
291
#in .char()
283
- lines = rv .split ("\n " )
284
292
285
- if lines :
286
- #Add number of lines passed onto positon
287
- oldCol = self .col
288
- self .line += len (lines )- 1
289
- if len (lines ) > 1 :
290
- self .col = len (lines [- 1 ])
291
- else :
292
- self .col += len (lines [0 ])
293
-
294
- if self .lineLengths and oldCol > 0 :
295
- self .lineLengths [- 1 ] += len (lines [0 ])
296
- lines = lines [1 :- 1 ]
297
- else :
298
- lines = lines [:- 1 ]
293
+ #XXX Temporarily disable this because there is a bug
299
294
300
- for line in lines :
301
- self .lineLengths .append (len (line ))
302
-
303
- self .queue = self .queue [i :]
295
+ #lines = rv.split("\n")
296
+ #
297
+ #if lines:
298
+ # #Add number of lines passed onto positon
299
+ # oldCol = self.col
300
+ # self.line += len(lines)-1
301
+ # if len(lines) > 1:
302
+ # self.col = len(lines[-1])
303
+ # else:
304
+ # self.col += len(lines[0])
305
+ #
306
+ # if self.lineLengths and oldCol > 0:
307
+ # self.lineLengths[-1] += len(lines[0])
308
+ # lines = lines[1:-1]
309
+ # else:
310
+ # lines = lines[:-1]
311
+ #
312
+ # for line in lines:
313
+ # self.lineLengths.append(len(line))
314
+ #
304
315
305
316
return rv
306
317
0 commit comments