mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-11 18:32:12 +02:00
avoid extra string copy in Stringwidth
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
package wcswidth
|
||||
|
||||
import "kitty/tools/utils"
|
||||
|
||||
func IsFlagCodepoint(ch rune) bool {
|
||||
return 0x1F1E6 <= ch && ch <= 0x1F1FF
|
||||
}
|
||||
@@ -89,5 +91,5 @@ func (self *WCWidthIterator) Parse(b []byte) (ans int) {
|
||||
|
||||
func Stringwidth(text string) int {
|
||||
w := CreateWCWidthIterator()
|
||||
return w.Parse([]byte(text))
|
||||
return w.Parse(utils.UnsafeStringToBytes(text))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user