Skip to content

Commit

Permalink
Break lines after hyphens
Browse files Browse the repository at this point in the history
Because this is sort of what hyphens are for.

Fixes: #252
  • Loading branch information
walles committed Nov 2, 2024
1 parent 07be8d8 commit f0d198f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions m/linewrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ func getWrapCount(line []twin.StyledRune, maxScreenCellsCount int) int {
}
}

if cutBeforeThisIndex > 0 {
// Break after a hyphen / dash. That's something people do.
previousChar := line[cutBeforeThisIndex-1].Rune
if previousChar == '-' && char != '-' {
canBreakHere = true
}
}

if canBreakHere {
bestCutPoint = cutBeforeThisIndex
}
Expand Down

0 comments on commit f0d198f

Please sign in to comment.