The rendering on windows should be much more pleasant now.
You can go back to support by adding --disable-UTF8=false to your CLI paramters
ADD
config/flags_windows.go
+package config
+
+// 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
\ No newline at end of file

MODIFY
discordutil/channel.go
discordutil/channel.go
@@ -2,11 +2,11 @@ package discordutil
import (
"fmt"
+ "github.com/Bios-Marcel/cordless/ui/tviewutil"
"sort"
"strconv"
"github.com/Bios-Marcel/discordgo"
- "github.com/Bios-Marcel/tview"
)
// SortMessagesByTimestamp sorts all messages in the given array according to
@@ -50,7 +50,7 @@ func GetPrivateChannelName(channel *discordgo.Channel) string {
channelName = "Unnamed"
}
- return tview.Escape(channelName)
+ return tviewutil.Escape(channelName)
}
// CompareChannels checks which channel is smaller. Smaller meaning it is the

MODIFY
discordutil/users.go
discordutil/users.go
@@ -72,7 +72,7 @@ func GetUserName(user *discordgo.User) string {
}
func getUserName(name string, bot bool) string {
- discordName := tview.Escape(name)
+ discordName := tviewutil.Escape(name)
if bot {
return botPrefix + discordName

MODIFY
go.mod
go.mod
@@ -15,6 +15,7 @@ require (
github.com/godbus/dbus v4.1.0+incompatible // indirect
github.com/google/go-github/v28 v28.1.1
github.com/gopherjs/gopherwasm v1.1.0 // indirect
+ github.com/mattn/go-runewidth v0.0.4
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/pkg/errors v0.8.1
github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d

MODIFY
go.sum
go.sum
@@ -6,8 +6,6 @@ github.com/Bios-Marcel/goclipimg v0.0.0-20190417192721-b58a8831f27d h1:vfrX8l3fH
github.com/Bios-Marcel/goclipimg v0.0.0-20190417192721-b58a8831f27d/go.mod h1:u7z9t086HoIbA/uuoA2KcRDhKS47DRYCDZ39aegTR4c=
github.com/Bios-Marcel/shortnotforlong v1.0.0 h1:K4JJ5U3+D8LXoAiH0QbfMujWuqKo+NAEZKuQ2RHPqqE=
github.com/Bios-Marcel/shortnotforlong v1.0.0/go.mod h1:g6bFiwq0pq7pqENRgHiCZu7uMzeYPIXwANlaBQ47LBw=
-github.com/Bios-Marcel/tview v0.0.0-20191011210517-9ff18389d0f6 h1:MNgdsJiHHU543t+6pp7Qt09jcF2gJq0ZsQA8cKONXYQ=
-github.com/Bios-Marcel/tview v0.0.0-20191011210517-9ff18389d0f6/go.mod h1:AtXfMotMUyN+IQ7JwQyvrWr9dQN+TNRlq+slKB0fmQc=
github.com/Bios-Marcel/tview v0.0.0-20191024171520-41147a2f8cf9 h1:QA/UeZGq+mf8WHba3wVL8UNB5juTWHPngduDlOppH2w=
github.com/Bios-Marcel/tview v0.0.0-20191024171520-41147a2f8cf9/go.mod h1:AtXfMotMUyN+IQ7JwQyvrWr9dQN+TNRlq+slKB0fmQc=
github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08=

MODIFY
main.go
main.go
-//+build go1.12
+//+build go1.12,!windows
package main

ADD
main_windows.go
+//+build go1.12
+
+package main
+
+import (
+ "flag"
+ "fmt"
+ "github.com/Bios-Marcel/cordless/app"
+ "github.com/Bios-Marcel/cordless/config"
+ "github.com/Bios-Marcel/cordless/version"
+)
+
+func main() {
+ showVersion := flag.Bool("version", false, "Show the version instead of starting cordless")
+ flag.BoolVar(&config.DisableUTF8, "disable-UTF8", true, "Replaces certain characters with question marks in order to avoid broken rendering")
+ flag.Parse()
+
+ if showVersion != nil && *showVersion {
+ fmt.Printf("You are running cordless version %s\nKeep in mind that this version might not be correct for manually built versions, as those can contain additional commits.\n", version.Version)
+ } else {
+ app.Run()
+ }
+}

MODIFY
ui/chatview.go
ui/chatview.go
@@ -467,7 +467,7 @@ func (chatView *ChatView) formatMessageText(message *discordgo.Message) string {
}
func (chatView *ChatView) formatDefaultMessageText(message *discordgo.Message) string {
- messageText := tview.Escape(message.Content)
+ messageText := tviewutil.Escape(message.Content)
//Message.MentionRoles only contains the mentions for mentionable.
//Therefore we do it like this, in order to render every mention.

MODIFY
ui/guildlist.go
ui/guildlist.go
@@ -2,6 +2,7 @@ package ui
import (
"github.com/Bios-Marcel/cordless/config"
+ "github.com/Bios-Marcel/cordless/ui/tviewutil"
"github.com/Bios-Marcel/discordgo"
"github.com/Bios-Marcel/tview"
)
@@ -41,7 +42,7 @@ func NewGuildList(guilds []*discordgo.Guild, window *Window) *GuildList {
if guild.Name == "" {
continue
}
- guildNode := tview.NewTreeNode(tview.Escape(guild.Name))
+ guildNode := tview.NewTreeNode(tviewutil.Escape(guild.Name))
guildNode.SetReference(guild.ID)
root.AddChild(guildNode)
@@ -81,7 +82,7 @@ func (g *GuildList) RemoveGuild(guildID string) {
// AddGuild adds a new node that references the given guildID and shows the
// given name.
func (g *GuildList) AddGuild(guildID, name string) {
- node := tview.NewTreeNode(tview.Escape(name))
+ node := tview.NewTreeNode(tviewutil.Escape(name))
node.SetReference(guildID)
g.GetRoot().AddChild(node)
}
@@ -90,7 +91,7 @@ func (g *GuildList) AddGuild(guildID, name string) {
func (g *GuildList) UpdateName(guildID, newName string) {
for _, node := range g.GetRoot().GetChildren() {
if node.GetReference() == guildID {
- node.SetText(tview.Escape(newName))
+ node.SetText(tviewutil.Escape(newName))
break
}
}

MODIFY
ui/login.go
ui/login.go
package ui
import (
+ "github.com/Bios-Marcel/cordless/ui/tviewutil"
"github.com/Bios-Marcel/tview"
"github.com/atotto/clipboard"
"github.com/gdamore/tcell"
@@ -42,7 +43,7 @@ func NewLogin(app *tview.Application, configDir string) *Login {
splashScreen := tview.NewTextView()
splashScreen.SetTextAlign(tview.AlignCenter)
- splashScreen.SetText(tview.Escape(splashText + "\n\nConfig lies at: " + configDir))
+ splashScreen.SetText(tviewutil.Escape(splashText + "\n\nConfig lies at: " + configDir))
login.messageText.SetDynamicColors(true)

ADD
ui/tviewutil/escape.go
+//+build !windows
+
+package tviewutil
+
+import (
+ "github.com/Bios-Marcel/tview"
+)
+
+// Escape delegates to tview escape, optionally doing additional escaping.
+func Escape(text string) string {
+ return tview.Escape(text)
+}

ADD
ui/tviewutil/escape_windows.go
+package tviewutil
+
+import (
+ "github.com/Bios-Marcel/cordless/config"
+ "github.com/Bios-Marcel/tview"
+ "github.com/mattn/go-runewidth"
+)
+
+// Escape delegates to tview escape, optionally doing additional escaping.
+func Escape(text string) string {
+ if config.DisableUTF8 {
+ runes := []rune(text)
+ for index, r := range runes {
+ if r > 65536 || runewidth.RuneWidth(r) > 1 {
+ runes[index] = '?'
+ }
+ }
+
+ return tview.Escape(string(runes))
+ }
+
+ return tview.Escape(text)
+}

The rendering on windows should be much more pleasant now.
You can go back to UTF-8 support by adding --disable-UTF8=false to your CLI paramters