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