From 62946ab52ff2d5ae3bff66236f3a56a7cca85643 Mon Sep 17 00:00:00 2001 From: Marcel Schramm Date: Wed, 21 Oct 2020 20:15:22 +0200 Subject: [PATCH] Attempt 2 at enabling UTF8 by default on new WT --- config/flags_windows.go | 12 +++++++++++- flags_windows.go | 6 +----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/flags_windows.go b/config/flags_windows.go index 307d81c..13d3487 100644 --- a/config/flags_windows.go +++ b/config/flags_windows.go @@ -1,5 +1,15 @@ package config +import ( + "os" + "strings" +) + // DisableUTF8 set to true will cause cordless to replace characters with a // codepoint higher than 65536 or a runewidth of more than one character. -var DisableUTF8 = true +var DisableUTF8 bool + +func init() { + wtSessionValue, avail := os.LookupEnv("WT_SESSION") + DisableUTF8 = !avail || strings.TrimSpace(wtSessionValue) == "" +} diff --git a/flags_windows.go b/flags_windows.go index 343416b..e8dd936 100644 --- a/flags_windows.go +++ b/flags_windows.go @@ -2,14 +2,10 @@ package main import ( "flag" - "os" - "strings" "github.com/Bios-Marcel/cordless/config" ) func init() { - wtSessionValue, avail := os.LookupEnv("WT_SESSION") - disableUTF8Default = !avail || strings.TrimSpace(wtSessionValue) == "" - flag.BoolVar(&config.DisableUTF8, "disable-UTF8", disableUTF8Default, "Replaces certain characters with question marks in order to avoid broken rendering") + flag.BoolVar(&config.DisableUTF8, "disable-UTF8", config.DisableUTF8, "Replaces certain characters with question marks in order to avoid broken rendering") }