@@ -3773,12 +3773,14 @@ function! s:StringReader.__init__(lines)
37733773 let self .buf = []
37743774 let self .pos = []
37753775 let lnum = 0
3776+ let offset = 0
37763777 while lnum < len (a: lines )
37773778 let col = 0
37783779 for c in split (a: lines [lnum], ' \zs' )
37793780 call add (self .buf , c )
3780- call add (self .pos, [lnum + 1 , col + 1 ])
3781+ call add (self .pos, [lnum + 1 , col + 1 , offset ])
37813782 let col += len (c )
3783+ let offset += len (c )
37823784 endfor
37833785 while lnum + 1 < len (a: lines ) && a: lines [lnum + 1 ] = ~# ' ^\s*\\'
37843786 let skip = s: TRUE
@@ -3790,18 +3792,21 @@ function! s:StringReader.__init__(lines)
37903792 endif
37913793 else
37923794 call add (self .buf , c )
3793- call add (self .pos, [lnum + 2 , col + 1 ])
3795+ call add (self .pos, [lnum + 2 , col + 1 , offset ])
37943796 endif
37953797 let col += len (c )
3798+ let offset += len (c )
37963799 endfor
37973800 let lnum += 1
3801+ let offset += 1
37983802 endwhile
37993803 call add (self .buf , ' <EOL>' )
3800- call add (self .pos, [lnum + 1 , col + 1 ])
3804+ call add (self .pos, [lnum + 1 , col + 1 , offset ])
38013805 let lnum += 1
3806+ let offset += 1
38023807 endwhile
38033808 " for <EOF>
3804- call add (self .pos, [lnum + 1 , 0 ])
3809+ call add (self .pos, [lnum + 1 , 0 , offset ])
38053810 let self .i = 0
38063811endfunction
38073812
@@ -3895,8 +3900,8 @@ function! s:StringReader.getstr(begin, end)
38953900endfunction
38963901
38973902function ! s: StringReader .getpos ()
3898- let [lnum, col ] = self .pos[self .i ]
3899- return {' i' : self .i , ' lnum' : lnum, ' col' : col }
3903+ let [lnum, col , offset ] = self .pos[self .i ]
3904+ return {' i' : self .i , ' lnum' : lnum, ' col' : col , ' offset ' : offset }
39003905endfunction
39013906
39023907function ! s: StringReader .setpos (pos)
0 commit comments