mirror of
https://github.com/alecthomas/chroma.git
synced 2025-01-28 03:29:41 +02:00
Use utf8.RuneCountInString() rather than len() :(
Fixes #10. Thanks @curio77.
This commit is contained in:
parent
3f941ddff4
commit
36ead7258a
@ -5,6 +5,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/dlclark/regexp2"
|
||||
)
|
||||
@ -221,7 +222,7 @@ func (r *RegexLexer) Tokenise(options *TokeniseOptions, text string, out func(*T
|
||||
state.Rule = ruleIndex
|
||||
|
||||
state.Groups = groups
|
||||
state.Pos += len(groups[0])
|
||||
state.Pos += utf8.RuneCountInString(groups[0])
|
||||
if rule.Mutator != nil {
|
||||
if err := rule.Mutator.Mutate(state); err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user