summaryrefslogtreecommitdiffstats
path: root/pkg/gui/presentation
diff options
context:
space:
mode:
authormjarkk <mkopenga@gmail.com>2021-07-23 12:04:23 +0200
committermjarkk <mkopenga@gmail.com>2021-07-23 12:04:23 +0200
commitfc76b44b4569247462462db0126a739d87781888 (patch)
treea08786563e1f48586c116d73a1d66074d1833607 /pkg/gui/presentation
parent9a087d04ebaed311e0bd3d9cbd32dd2973f0406c (diff)
correctly show files with special chars in commit
Diffstat (limited to 'pkg/gui/presentation')
-rw-r--r--pkg/gui/presentation/commit_files.go1
-rw-r--r--pkg/gui/presentation/files.go12
2 files changed, 2 insertions, 11 deletions
diff --git a/pkg/gui/presentation/commit_files.go b/pkg/gui/presentation/commit_files.go
index 94116066a..7e9d4bdfa 100644
--- a/pkg/gui/presentation/commit_files.go
+++ b/pkg/gui/presentation/commit_files.go
@@ -28,6 +28,7 @@ func GetCommitFileLine(name string, diffName string, commitFile *models.CommitFi
}
}
+ name = utils.EscapeSpecialChars(name)
if commitFile == nil {
return colour.Sprint(name)
}
diff --git a/pkg/gui/presentation/files.go b/pkg/gui/presentation/files.go
index f45ef04d3..8b3aacf56 100644
--- a/pkg/gui/presentation/files.go
+++ b/pkg/gui/presentation/files.go
@@ -1,8 +1,6 @@
package presentation
import (
- "strings"
-
"github.com/fatih/color"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/theme"
@@ -50,15 +48,7 @@ func GetFileLine(hasUnstagedChanges bool, hasStagedChanges bool, name string, di
output += restColor.Sprint(" ")
}
- name = strings.NewReplacer(
- "\n", "\\n",
- "\r", "\\r",
- "\t", "\\t",
- "\b", "\\b",
- "\f", "\\f",
- "\v", "\\v",
- ).Replace(name)
- output += restColor.Sprint(name)
+ output += restColor.Sprint(utils.EscapeSpecialChars(name))
if file != nil && file.IsSubmodule(submoduleConfigs) {
output += utils.ColoredString(" (submodule)", theme.DefaultTextColor)