Use CharacterCount over RuneCount

This commit is contained in:
Zachary Yedidia
2020-05-20 16:47:08 -04:00
parent bdff221870
commit 79c0ea17ad
17 changed files with 64 additions and 83 deletions

View File

@@ -5,10 +5,9 @@ import (
"bytes"
"io"
"sync"
"unicode/utf8"
"github.com/zyedidia/micro/v2/pkg/highlight"
"github.com/zyedidia/micro/v2/internal/util"
"github.com/zyedidia/micro/v2/pkg/highlight"
)
// Finds the byte index of the nth rune in a byte slice
@@ -300,7 +299,7 @@ func (la *LineArray) Start() Loc {
// End returns the location of the last character in the buffer
func (la *LineArray) End() Loc {
numlines := len(la.lines)
return Loc{utf8.RuneCount(la.lines[numlines-1].data), numlines - 1}
return Loc{util.CharacterCount(la.lines[numlines-1].data), numlines - 1}
}
// LineBytes returns line n as an array of bytes