diff --git a/internal/span/utf16.go b/internal/span/utf16.go index 4cc16a17..79f35f2d 100644 --- a/internal/span/utf16.go +++ b/internal/span/utf16.go @@ -14,9 +14,12 @@ import ( // This is used to convert from the native (always in bytes) column // representation and the utf16 counts used by some editors. func ToUTF16Column(offsets Offsets, p Point, content []byte) int { - if content == nil || p.Column < 1 { + if content == nil || p.Column < 0 { return -1 } + if p.Column == 0 { + return 1 + } // make sure we have a valid offset p.updateOffset(offsets) lineOffset := p.Offset - (p.Column - 1)