1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Factor out into NormalizeLinefeeds; add tests

This commit is contained in:
Tommy Nguyen
2018-08-19 07:20:50 -04:00
parent b46d174f70
commit cea736e6e9
4 changed files with 54 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import (
"time"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/spkg/bom"
)
@ -218,8 +219,7 @@ func (gui *Gui) renderString(g *gocui.Gui, viewName, s string) error {
return nil
}
v.Clear()
output := string(bom.Clean([]byte(s)))
output = strings.Replace(output, "\r", "\r\n", -1)
output := utils.NormalizeLinefeeds(string(bom.Clean([]byte(s))))
fmt.Fprint(v, output)
v.Wrap = true
return nil