@@ -11,6 +11,7 @@ import (
1111 "github.com/jesseduffield/lazygit/pkg/utils"
1212 "github.com/kyokomi/emoji/v2"
1313 colorful "github.com/lucasb-eyer/go-colorful"
14+ "github.com/mattn/go-runewidth"
1415)
1516
1617func GetCommitListDisplayStrings (commits []* models.Commit , fullDescription bool , cherryPickedCommitShaMap map [string ]bool , diffName string , parseEmoji bool ) [][]string {
@@ -166,19 +167,16 @@ func randFloat(hash []byte) float64 {
166167 return float64 (sum ) / 100
167168}
168169
169- var authorStyles = []style.TextStyle {
170- style .FgGreen ,
171- style .FgYellow ,
172- style .FgMagenta ,
173- style .FgCyan ,
174- style .FgRed ,
175- }
176-
177170func getInitials (authorName string ) string {
178171 if authorName == "" {
179172 return authorName
180173 }
181174
175+ firstRune := getFirstRune (authorName )
176+ if runewidth .RuneWidth (firstRune ) > 1 {
177+ return string (firstRune )
178+ }
179+
182180 split := strings .Split (authorName , " " )
183181 if len (split ) == 1 {
184182 return utils .LimitStr (authorName , 2 )
@@ -187,6 +185,15 @@ func getInitials(authorName string) string {
187185 return utils .LimitStr (split [0 ], 1 ) + utils .LimitStr (split [1 ], 1 )
188186}
189187
188+ func getFirstRune (str string ) rune {
189+ // just using the loop for the sake of getting the first rune
190+ for _ , r := range str {
191+ return r
192+ }
193+ // should never land here
194+ return 0
195+ }
196+
190197func actionColorMap (str string ) style.TextStyle {
191198 switch str {
192199 case "pick" :
0 commit comments