Skip to content

Commit b129680

Browse files
committed
fix: Default to East Asian ambiguous width as 1 unless RUNEWIDTH_EASTASIAN is true (fixes #839)
1 parent ef3e35b commit b129680

3 files changed

Lines changed: 11 additions & 100 deletions

File tree

eastasian_wasm.go renamed to eastasian.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build js || wasm
2-
// +build js wasm
3-
41
// Copyright 2025 The TCell Authors
52
//
63
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,8 +14,17 @@
1714

1815
package tcell
1916

20-
import "github.com/rivo/uniseg"
17+
import (
18+
"os"
19+
"strings"
20+
21+
"github.com/rivo/uniseg"
22+
)
2123

2224
func init() {
23-
uniseg.EastAsianAmbiguousWidth = 1
25+
if rw := strings.ToLower(os.Getenv("RUNEWIDTH_EASTASIAN")); rw == "1" || rw == "true" || rw == "yes" {
26+
uniseg.EastAsianAmbiguousWidth = 2
27+
} else {
28+
uniseg.EastAsianAmbiguousWidth = 1
29+
}
2430
}

eastasian_unix.go

Lines changed: 0 additions & 43 deletions
This file was deleted.

eastasian_win.go

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)