mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-10 20:05:50 +02:00
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 #3811 fixed linting issues
This commit is contained in:
parent
a5698b86fa
commit
ecf644d66a
1 changed files with 10 additions and 4 deletions
|
@ -2,6 +2,7 @@ package presentation
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -15,7 +16,6 @@ import (
|
|||
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
||||
"github.com/jesseduffield/lazygit/pkg/theme"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
"github.com/kyokomi/emoji/v2"
|
||||
"github.com/samber/lo"
|
||||
"github.com/sasha-s/go-deadlock"
|
||||
"github.com/stefanhaller/git-todo-parser/todo"
|
||||
|
@ -37,6 +37,12 @@ type bisectBounds struct {
|
|||
oldIndex int
|
||||
}
|
||||
|
||||
func stripEmojis(text string) string {
|
||||
// This regex matches most common emoji patterns
|
||||
re := regexp.MustCompile(`[\x{1F600}-\x{1F64F}]|[\x{1F300}-\x{1F5FF}]|[\x{1F680}-\x{1F6FF}]|[\x{2600}-\x{26FF}]|[\x{2700}-\x{27BF}]`)
|
||||
return re.ReplaceAllString(text, "")
|
||||
}
|
||||
|
||||
func GetCommitListDisplayStrings(
|
||||
common *common.Common,
|
||||
commits []*models.Commit,
|
||||
|
@ -366,6 +372,7 @@ func displayCommit(
|
|||
bisectInfo *git_commands.BisectInfo,
|
||||
isYouAreHereCommit bool,
|
||||
) []string {
|
||||
_ = parseEmoji
|
||||
bisectString := getBisectStatusText(bisectStatus, bisectInfo)
|
||||
|
||||
hashString := ""
|
||||
|
@ -423,9 +430,8 @@ func displayCommit(
|
|||
if commit.Action == todo.UpdateRef {
|
||||
name = strings.TrimPrefix(name, "refs/heads/")
|
||||
}
|
||||
if parseEmoji {
|
||||
name = emoji.Sprint(name)
|
||||
}
|
||||
|
||||
name = stripEmojis(name) // Strip emojis
|
||||
|
||||
mark := ""
|
||||
if isYouAreHereCommit {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue