From 4592aaf63de9451416d31210e58d3542ed843025 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Mon, 13 Jan 2020 15:36:43 -0600 Subject: [PATCH] clarify newline normalization --- utils/utils.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 49d9cae2c..2fc878469 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -56,11 +56,8 @@ func searchBrowserLauncher(goos string) (browser string) { } func normalizeNewlines(d []byte) []byte { - // from https://github.com/MichaelMure/go-term-markdown/issues/1#issuecomment-570702862 - // replace CR LF \r\n (windows) with LF \n (unix) - d = bytes.Replace(d, []byte{13, 10}, []byte{10}, -1) - // replace CF \r (mac) with LF \n (unix) - d = bytes.Replace(d, []byte{13}, []byte{10}, -1) + d = bytes.Replace(d, []byte("\r\n"), []byte("\n"), -1) + d = bytes.Replace(d, []byte("\r"), []byte("\n"), -1) return d }