mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-23 16:22:24 +03:00
Modernize all codes
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...
This commit is contained in:
@@ -109,11 +109,7 @@ func (self *ConfirmationHelper) getPopupPanelWidth() int {
|
||||
panelWidth := 4 * width / 7
|
||||
minWidth := 80
|
||||
if panelWidth < minWidth {
|
||||
if width-2 < minWidth {
|
||||
panelWidth = width - 2
|
||||
} else {
|
||||
panelWidth = minWidth
|
||||
}
|
||||
panelWidth = min(width-2, minWidth)
|
||||
}
|
||||
|
||||
return panelWidth
|
||||
|
||||
@@ -225,8 +225,8 @@ func (self *FixupHelper) blameDeletedLines(deletedLineHunks []*hunk) ([]string,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
blameLines := strings.Split(strings.TrimSuffix(blameOutput, "\n"), "\n")
|
||||
for _, line := range blameLines {
|
||||
blameLines := strings.SplitSeq(strings.TrimSuffix(blameOutput, "\n"), "\n")
|
||||
for line := range blameLines {
|
||||
hashChan <- strings.Split(line, " ")[0]
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -59,9 +59,9 @@ func (self *ReposHelper) getCurrentBranch(path string) string {
|
||||
content := strings.TrimSpace(string(headFile))
|
||||
refsPrefix := "ref: refs/heads/"
|
||||
var branchDisplay string
|
||||
if strings.HasPrefix(content, refsPrefix) {
|
||||
if bareName, ok := strings.CutPrefix(content, refsPrefix); ok {
|
||||
// is a branch
|
||||
branchDisplay = strings.TrimPrefix(content, refsPrefix)
|
||||
branchDisplay = bareName
|
||||
} else {
|
||||
// detached HEAD state, displaying short hash
|
||||
branchDisplay = utils.ShortHash(content)
|
||||
|
||||
@@ -2,6 +2,7 @@ package helpers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
mapsPkg "maps"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
@@ -194,9 +195,7 @@ func mainPanelChildren(args WindowArrangementArgs) []*boxlayout.Box {
|
||||
func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V {
|
||||
result := map[K]V{}
|
||||
for _, currMap := range maps {
|
||||
for key, value := range currMap {
|
||||
result[key] = value
|
||||
}
|
||||
mapsPkg.Copy(result, currMap)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user