@@ -3772,15 +3772,13 @@ endfunction
37723772function ! s: StringReader .__init__ (lines )
37733773 let self .buf = []
37743774 let self .pos = []
3775- let self .offset = []
37763775 let lnum = 0
37773776 let offset = 0
37783777 while lnum < len (a: lines )
37793778 let col = 0
37803779 for c in split (a: lines [lnum], ' \zs' )
37813780 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])
37843782 let col += len (c )
37853783 let offset += len (c )
37863784 endfor
@@ -3794,8 +3792,7 @@ function! s:StringReader.__init__(lines)
37943792 endif
37953793 else
37963794 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])
37993796 endif
38003797 let col += len (c )
38013798 let offset += len (c )
@@ -3804,14 +3801,12 @@ function! s:StringReader.__init__(lines)
38043801 let offset += 1
38053802 endwhile
38063803 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])
38093805 let lnum += 1
38103806 let offset += 1
38113807 endwhile
38123808 " 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])
38153810 let self .i = 0
38163811endfunction
38173812
@@ -3905,8 +3900,8 @@ function! s:StringReader.getstr(begin, end)
39053900endfunction
39063901
39073902function ! 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}
39103905endfunction
39113906
39123907function ! s: StringReader .setpos (pos)
0 commit comments