Move escape code parser into wcswidth package

This commit is contained in:
Kovid Goyal
2022-08-25 05:55:38 +05:30
parent 9be2247081
commit 7280c712d6
6 changed files with 30 additions and 27 deletions

View File

@@ -26,7 +26,7 @@ const (
UTF8_REJECT = 1
)
func decode_utf8(state *UTF8State, codep *UTF8State, byte_ byte) UTF8State {
func DecodeUtf8(state *UTF8State, codep *UTF8State, byte_ byte) UTF8State {
typ := UTF8State(utf8_data[byte_])
b := UTF8State(byte_)
@@ -41,7 +41,7 @@ func decode_utf8(state *UTF8State, codep *UTF8State, byte_ byte) UTF8State {
return *state
}
func encode_utf8(ch UTF8State, dest []byte) int {
func EncodeUtf8(ch UTF8State, dest []byte) int {
if ch < 0x80 {
dest[0] = byte(ch)
return 1