mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 04:45:47 +02:00
better commit lines in fullscreen mode
This commit is contained in:
parent
b8717d750a
commit
9fd9fd6816
7 changed files with 202 additions and 102 deletions
|
@ -348,3 +348,22 @@ func PrevIntInCycle(sl []int, current int) int {
|
|||
}
|
||||
return sl[len(sl)-1]
|
||||
}
|
||||
|
||||
// TruncateWithEllipsis returns a string, truncated to a certain length, with an ellipsis
|
||||
func TruncateWithEllipsis(str string, limit int) string {
|
||||
if limit == 1 && len(str) > 1 {
|
||||
return "."
|
||||
}
|
||||
|
||||
if limit == 2 && len(str) > 2 {
|
||||
return ".."
|
||||
}
|
||||
|
||||
ellipsis := "..."
|
||||
if len(str) <= limit {
|
||||
return str
|
||||
}
|
||||
|
||||
remainingLength := limit - len(ellipsis)
|
||||
return str[0:remainingLength] + "..."
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue