@@ -3768,15 +3768,13 @@ endfunction
3768
3768
function ! s: StringReader .__init__ (lines )
3769
3769
let self .buf = []
3770
3770
let self .pos = []
3771
- let self .offset = []
3772
3771
let lnum = 0
3773
3772
let offset = 0
3774
3773
while lnum < len (a: lines )
3775
3774
let col = 0
3776
3775
for c in split (a: lines [lnum], ' \zs' )
3777
3776
call add (self .buf , c )
3778
- call add (self .pos, [lnum + 1 , col + 1 ])
3779
- call add (self .offset, offset)
3777
+ call add (self .pos, [lnum + 1 , col + 1 , offset])
3780
3778
let col += len (c )
3781
3779
let offset += len (c )
3782
3780
endfor
@@ -3790,8 +3788,7 @@ function! s:StringReader.__init__(lines)
3790
3788
endif
3791
3789
else
3792
3790
call add (self .buf , c )
3793
- call add (self .pos, [lnum + 2 , col + 1 ])
3794
- call add (self .offset, offset)
3791
+ call add (self .pos, [lnum + 2 , col + 1 , offset])
3795
3792
endif
3796
3793
let col += len (c )
3797
3794
let offset += len (c )
@@ -3800,14 +3797,12 @@ function! s:StringReader.__init__(lines)
3800
3797
let offset += 1
3801
3798
endwhile
3802
3799
call add (self .buf , ' <EOL>' )
3803
- call add (self .pos, [lnum + 1 , col + 1 ])
3804
- call add (self .offset, offset)
3800
+ call add (self .pos, [lnum + 1 , col + 1 , offset])
3805
3801
let lnum += 1
3806
3802
let offset += 1
3807
3803
endwhile
3808
3804
" for <EOF>
3809
- call add (self .pos, [lnum + 1 , 0 ])
3810
- call add (self .offset, offset)
3805
+ call add (self .pos, [lnum + 1 , 0 , offset])
3811
3806
let self .i = 0
3812
3807
endfunction
3813
3808
@@ -3901,8 +3896,8 @@ function! s:StringReader.getstr(begin, end)
3901
3896
endfunction
3902
3897
3903
3898
function ! s: StringReader .getpos ()
3904
- let [lnum, col ] = self .pos[self .i ]
3905
- return {' i' : self .i , ' lnum' : lnum, ' col' : col , ' offset' : self . offset[ self . i ] }
3899
+ let [lnum, col , offset ] = self .pos[self .i ]
3900
+ return {' i' : self .i , ' lnum' : lnum, ' col' : col , ' offset' : offset}
3906
3901
endfunction
3907
3902
3908
3903
function ! s: StringReader .setpos (pos)
0 commit comments