mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Fix several bugs in wrapMessageToWidth
This corresponds to the following fixes in gocui's lineWrap function: -86cf561ef4
-24746d5cd6
-4b97941c4e
This commit is contained in:
parent
2417b70acd
commit
3610f13418
1 changed files with 3 additions and 5 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue