1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

NormalizeLinefeeds removes rather than converts Window/Mac style lf's

This commit is contained in:
Tommy Nguyen
2018-08-19 08:48:03 -04:00
parent d2bdac29aa
commit 766197de9d
3 changed files with 15 additions and 13 deletions

View File

@ -64,9 +64,10 @@ func TrimTrailingNewline(str string) string {
return str
}
// NormalizeLinefeeds - Removes all Windows and Mac style line feeds
func NormalizeLinefeeds(str string) string {
str = strings.Replace(str, "\r\n", "\n", -1)
str = strings.Replace(str, "\r", "\n", -1)
str = strings.Replace(str, "\r\n", "", -1)
str = strings.Replace(str, "\r", "", -1)
return str
}