1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

Fix multibyte initial characters

This commit is contained in:
Ryooooooga
2021-10-23 20:46:37 +09:00
committed by Jesse Duffield
parent 253504a094
commit 6171690b00
3 changed files with 21 additions and 7 deletions

View File

@@ -146,8 +146,12 @@ func Reverse(values []string) []string {
}
func LimitStr(value string, limit int) string {
if len(value) > limit {
return value[:limit]
n := 0
for i := range value {
if n >= limit {
return value[:i]
}
n++
}
return value
}