From 51ab8f9914af6497f51cd3703328405418a61de5 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sat, 30 May 2020 18:11:52 -0400 Subject: [PATCH] Unicode replacement char for non-displayable chars --- internal/screen/screen.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/screen/screen.go b/internal/screen/screen.go index 419025ea..c5a80e72 100644 --- a/internal/screen/screen.go +++ b/internal/screen/screen.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "sync" + "unicode" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/util" @@ -97,6 +98,10 @@ func ShowCursor(x, y int) { // SetContent sets a cell at a point on the screen and makes sure that it is // synced with the last cursor location func SetContent(x, y int, mainc rune, combc []rune, style tcell.Style) { + if !unicode.IsPrint(mainc) { + mainc = '�' + } + Screen.SetContent(x, y, mainc, combc, style) if util.FakeCursor && lastCursor.x == x && lastCursor.y == y { lastCursor.r = mainc