Skip to content

Commit 5dccd7c

Browse files
committed
fix strips emoji fixing UI
Now the emoji is not visible in the commits panel. However a commit message is not changed it remains as is. This fixes the UI issue where it was distrubing the diff panel Closes jesseduffield#3811
1 parent a5698b8 commit 5dccd7c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pkg/gui/presentation/commits.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package presentation
22

33
import (
44
"fmt"
5+
"regexp"
56
"strings"
67
"time"
78

@@ -15,7 +16,6 @@ import (
1516
"github.com/jesseduffield/lazygit/pkg/gui/style"
1617
"github.com/jesseduffield/lazygit/pkg/theme"
1718
"github.com/jesseduffield/lazygit/pkg/utils"
18-
"github.com/kyokomi/emoji/v2"
1919
"github.com/samber/lo"
2020
"github.com/sasha-s/go-deadlock"
2121
"github.com/stefanhaller/git-todo-parser/todo"
@@ -37,6 +37,12 @@ type bisectBounds struct {
3737
oldIndex int
3838
}
3939

40+
func stripEmojis(text string) string {
41+
// This regex matches most common emoji patterns
42+
re := regexp.MustCompile(`[\x{1F600}-\x{1F64F}]|[\x{1F300}-\x{1F5FF}]|[\x{1F680}-\x{1F6FF}]|[\x{2600}-\x{26FF}]|[\x{2700}-\x{27BF}]`)
43+
return re.ReplaceAllString(text, "")
44+
}
45+
4046
func GetCommitListDisplayStrings(
4147
common *common.Common,
4248
commits []*models.Commit,
@@ -423,9 +429,8 @@ func displayCommit(
423429
if commit.Action == todo.UpdateRef {
424430
name = strings.TrimPrefix(name, "refs/heads/")
425431
}
426-
if parseEmoji {
427-
name = emoji.Sprint(name)
428-
}
432+
433+
name = stripEmojis(name) // Strip emojis
429434

430435
mark := ""
431436
if isYouAreHereCommit {

0 commit comments

Comments
 (0)