/
githubmirror
/
lazygit
Обзор
Документация
Войти
/
githubmirror
/
lazygit
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/commands/patch/patch_line.go
38 строк
814 B
Stefan Haller
Fix selection after staging an added line
19 мар 2026, 18:57
19 мар 2026, 18:57
6bfcab3
Код
Авторство
О чём код?
package patch import "github.com/samber/lo" type PatchLineKind int const ( PATCH_HEADER PatchLineKind = iota HUNK_HEADER ADDITION DELETION CONTEXT NEWLINE_MESSAGE ) type PatchLine struct { Kind PatchLineKind Content string // something like '+ hello' (note the first character is not removed) } func (self *PatchLine) IsChange() bool { return self.Kind == ADDITION || self.Kind == DELETION } func (self *PatchLine) IsAddition() bool { return self.Kind == ADDITION } func (self *PatchLine) IsDeletion() bool { return self.Kind == DELETION } // Returns the number of lines in the given slice that have one of the given kinds func nLinesWithKind(lines []*PatchLine, kinds []PatchLineKind) int { return lo.CountBy(lines, func(line *PatchLine) bool { return lo.Contains(kinds, line.Kind) }) }