mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
mouse support
This commit is contained in:
committed by
Jesse Duffield
parent
afbc028ad6
commit
8c0ea8f45f
@ -160,7 +160,8 @@ func renderDisplayableList(items []Displayable, isFocused bool) (string, error)
|
||||
return strings.Join(paddedDisplayStrings, "\n"), nil
|
||||
}
|
||||
|
||||
func decolorise(str string) string {
|
||||
// Decolorise strips a string of color
|
||||
func Decolorise(str string) string {
|
||||
re := regexp.MustCompile(`\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]`)
|
||||
return re.ReplaceAllString(str, "")
|
||||
}
|
||||
@ -172,7 +173,7 @@ func getPadWidths(stringArrays [][]string) []int {
|
||||
padWidths := make([]int, len(stringArrays[0])-1)
|
||||
for i := range padWidths {
|
||||
for _, strings := range stringArrays {
|
||||
uncoloredString := decolorise(strings[i])
|
||||
uncoloredString := Decolorise(strings[i])
|
||||
if len(uncoloredString) > padWidths[i] {
|
||||
padWidths[i] = len(uncoloredString)
|
||||
}
|
||||
|
Reference in New Issue
Block a user