• Daniel Martí's avatar
    text/template: fix pos info when trimming newlines · 9b8964bf
    Daniel Martí authored
    The lexer keeps the byte offset and the line for the rune it's currently
    on. This was simple enough up until whitespace trimming was introduced.
    
    With whitespace trimming, we might skip over newlines. In that case, the
    lexer wasn't properly updating the line counter. Fix it.
    
    Also, TestPos now checks that the line is correct too, which it was
    ignoring before. This was necessary to test this scenario in the lexer.
    
    Fixes #21778.
    
    Change-Id: I3880f3adf02662eac8f818d5caa6935cca9cb33b
    Reviewed-on: https://go-review.googlesource.com/61870
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    Reviewed-by: 's avatarRob Pike <r@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    9b8964bf
Name
Last commit
Last update
..
parse Loading commit data...
testdata Loading commit data...
doc.go Loading commit data...
example_test.go Loading commit data...
examplefiles_test.go Loading commit data...
examplefunc_test.go Loading commit data...
exec.go Loading commit data...
exec_test.go Loading commit data...
funcs.go Loading commit data...
helper.go Loading commit data...
multi_test.go Loading commit data...
option.go Loading commit data...
template.go Loading commit data...