mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-21 12:16:54 +02:00
Fix several bugs in wrapMessageToWidth
This corresponds to the following fixes in gocui's lineWrap function: - https://github.com/jesseduffield/gocui/pull/67/commits/86cf561ef493 - https://github.com/jesseduffield/gocui/pull/67/commits/24746d5cd6ee - https://github.com/jesseduffield/gocui/pull/67/commits/4b97941c4ec6
This commit is contained in:
parent
2417b70acd
commit
3610f13418
@ -87,16 +87,14 @@ func wrapMessageToWidth(wrap bool, message string, width int) []string {
|
||||
wrappedLines = append(wrappedLines, line[offset:i])
|
||||
offset = i
|
||||
n = rw
|
||||
} else if lastWhitespaceIndex != -1 && lastWhitespaceIndex+1 != i {
|
||||
} else if lastWhitespaceIndex != -1 {
|
||||
if line[lastWhitespaceIndex] == '-' {
|
||||
wrappedLines = append(wrappedLines, line[offset:lastWhitespaceIndex+1])
|
||||
offset = lastWhitespaceIndex + 1
|
||||
n = i - lastWhitespaceIndex
|
||||
} else {
|
||||
wrappedLines = append(wrappedLines, line[offset:lastWhitespaceIndex])
|
||||
offset = lastWhitespaceIndex + 1
|
||||
n = i - lastWhitespaceIndex + 1
|
||||
}
|
||||
offset = lastWhitespaceIndex + 1
|
||||
n = runewidth.StringWidth(line[offset : i+1])
|
||||
} else {
|
||||
wrappedLines = append(wrappedLines, line[offset:i])
|
||||
offset = i
|
||||
|
Loading…
x
Reference in New Issue
Block a user