-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The width of Box-drawing characters #14
Comments
It is depend on $LANG. And you can modify it to set EastAsianWidth. |
Now I added environment variable |
Thanks for the quick reply. Just a feedback for this patch: for some shell, such as |
renamed to RUNEWIDTH_EASTASIAN. |
Hi @mattn, When |
Do you want to forcibly disable RUNEWIDTH_EASTASIAN ? |
How about this patch ? diff --git a/runewidth.go b/runewidth.go
index 70de0dc..82568a1 100644
--- a/runewidth.go
+++ b/runewidth.go
@@ -4,12 +4,21 @@ import "os"
var (
// EastAsianWidth will be set true if the current locale is CJK
- EastAsianWidth = os.Getenv("RUNEWIDTH_EASTASIAN") == "1" || IsEastAsian()
+ EastAsianWidth bool
// DefaultCondition is a condition in current locale
DefaultCondition = &Condition{EastAsianWidth}
)
+func init() {
+ env := os.Getenv("RUNEWIDTH_EASTASIAN")
+ if env == "" {
+ EastAsianWidth = IsEastAsian()
+ } else {
+ EastAsianWidth = env == "1"
+ }
+}
+
type interval struct {
first rune
last rune |
Good idea, but why not force return 1? |
What do you mean "return"? |
I want to remove these characters |
Unfortunately, box-drawing characters are listed in ambiguous width characters. |
@mattn Ok,thanks. |
Check this for the definition of box-drawing (BD below) characters.
I found that these characters are defined to be of ambiguous width, so passing these to
RuneWidth
returns 2 in my environment. This is somehow inconvenient since AFAIK, terminal fonts tend to interpret BD characters in half-width.Is it possible to remove these characters from the ambiguous table? I can make the PR if you think this sounds sane.
Thanks.
The text was updated successfully, but these errors were encountered: