1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

bump gocui

This commit is contained in:
Jesse Duffield
2023-02-18 10:28:09 +11:00
parent c517d1e0a2
commit 01bf7f21e6
98 changed files with 3665 additions and 1269 deletions

View File

@ -1021,7 +1021,7 @@ func (g *Gui) drawSubtitle(v *View, fgColor, bgColor Attribute) error {
return nil
}
start := v.x1 - 5 - len(v.Subtitle)
start := v.x1 - 5 - runewidth.StringWidth(v.Subtitle)
if start < v.x0 {
return nil
}
@ -1050,7 +1050,7 @@ func (g *Gui) drawListFooter(v *View, fgColor, bgColor Attribute) error {
return nil
}
start := v.x1 - 1 - len(message)
start := v.x1 - 1 - runewidth.StringWidth(message)
if start < v.x0 {
return nil
}

View File

@ -31,6 +31,12 @@ var runeReplacements = map[rune]string{
'╰': "+",
'╯': "+",
'─': "-",
'═': "-",
'║': "|",
'╔': "+",
'╗': "+",
'╚': "+",
'╝': "+",
// using a hyphen here actually looks weird.
// We see these characters when in portrait mode
@ -146,10 +152,11 @@ func setTcellFontEffectStyle(st tcell.Style, attr Attribute) tcell.Style {
type gocuiEventType uint8
// GocuiEvent represents events like a keys, mouse actions, or window resize.
// The 'Mod', 'Key' and 'Ch' fields are valid if 'Type' is 'eventKey'.
// The 'MouseX' and 'MouseY' fields are valid if 'Type' is 'eventMouse'.
// The 'Width' and 'Height' fields are valid if 'Type' is 'eventResize'.
// The 'Err' field is valid if 'Type' is 'eventError'.
//
// The 'Mod', 'Key' and 'Ch' fields are valid if 'Type' is 'eventKey'.
// The 'MouseX' and 'MouseY' fields are valid if 'Type' is 'eventMouse'.
// The 'Width' and 'Height' fields are valid if 'Type' is 'eventResize'.
// The 'Err' field is valid if 'Type' is 'eventError'.
type GocuiEvent struct {
Type gocuiEventType
Mod Modifier

View File

@ -872,28 +872,34 @@ func (v *View) updateSearchPositions() {
var normalizedSearchStr string
// if we have any uppercase characters we'll do a case-sensitive search
if containsUpcaseChar(v.searcher.searchString) {
normalizedSearchStr = v.searcher.searchString
normalizeRune = func(r rune) rune { return r }
normalizedSearchStr = v.searcher.searchString
} else {
normalizedSearchStr = strings.ToLower(v.searcher.searchString)
normalizeRune = unicode.ToLower
normalizedSearchStr = strings.ToLower(v.searcher.searchString)
}
v.searcher.searchPositions = []cellPos{}
for y, line := range v.lines {
lineLoop:
for x := range line {
if normalizeRune(line[x].chr) == rune(normalizedSearchStr[0]) {
for offset := 1; offset < len(normalizedSearchStr); offset++ {
if len(line)-1 < x+offset {
continue lineLoop
}
if normalizeRune(line[x+offset].chr) != rune(normalizedSearchStr[offset]) {
continue lineLoop
}
x := 0
for startIdx, c := range line {
found := true
offset := 0
for _, c := range normalizedSearchStr {
if len(line)-1 < startIdx+offset {
found = false
break
}
if normalizeRune(line[startIdx+offset].chr) != c {
found = false
break
}
offset += 1
}
if found {
v.searcher.searchPositions = append(v.searcher.searchPositions, cellPos{x: x, y: y})
}
x += runewidth.RuneWidth(c.chr)
}
}
}
@ -1053,11 +1059,11 @@ func (v *View) viewLineLengthIgnoringTrailingBlankLines() int {
}
func (v *View) isPatternMatchedRune(x, y int) (bool, bool) {
searchStringLength := len(v.searcher.searchString)
searchStringWidth := runewidth.StringWidth(v.searcher.searchString)
for i, pos := range v.searcher.searchPositions {
adjustedY := y + v.oy
adjustedX := x + v.ox
if adjustedY == pos.y && adjustedX >= pos.x && adjustedX < pos.x+searchStringLength {
if adjustedY == pos.y && adjustedX >= pos.x && adjustedX < pos.x+searchStringWidth {
return true, i == v.searcher.currentSearchIndex
}
}