fix get_last_nl_from_pos when error is last token (#2882)
parent
f7c103d5d2
commit
475807566d
|
@ -208,7 +208,8 @@ fn (s mut Scanner) goto_scanner_position(scp ScannerPos) {
|
|||
s.last_nl_pos = scp.last_nl_pos
|
||||
}
|
||||
|
||||
fn (s mut Scanner) get_last_nl_from_pos(pos int) int {
|
||||
fn (s mut Scanner) get_last_nl_from_pos(_pos int) int {
|
||||
mut pos := if _pos >= s.text.len { s.text.len-1 } else { _pos }
|
||||
for i := pos; i >= 0; i-- {
|
||||
if s.text[i] == `\n` {
|
||||
return i
|
||||
|
|
Loading…
Reference in New Issue