Skip to content

Commit

Permalink
undo no-longer-needed temporary RichText CJK wrapping fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Dec 15, 2024
1 parent 1cf09b2 commit d08dc42
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions widget/richtext.go
Original file line number Diff line number Diff line change
Expand Up @@ -1065,28 +1065,11 @@ func lineBounds(seg *TextSegment, wrap fyne.TextWrap, trunc fyne.TextTruncation,
}
default:
if trunc == fyne.TextTruncateEllipsis {
// Supersonic: tmp fix for https://github.com/fyne-io/fyne/issues/4998
high = binarySearch(widthChecker, low, high)
ellipsis := high < len(text)
if ellipsis && high > 0 && low < high {
// trim off up to 2 characters to make room for ellipsis
ellipsisWidth := fyne.MeasureText("…", seg.size(), seg.Style.TextStyle).Width
if fyne.MeasureText(string(text[high-1:high]), seg.size(), seg.Style.TextStyle).Width < ellipsisWidth && high > 1 && low < high-1 {
high -= 2
} else {
high -= 1
}
}
bounds = append(bounds, rowBoundary{[]RichTextSegment{seg}, reuse, low, high, ellipsis})
reuse++

/* orig Fyne code:
txt := []rune(seg.Text)[low:high]
end, full := truncateLimit(string(txt), seg.Visual().(*canvas.Text), int(measureWidth), []rune{'…'})
high = low + end
bounds = append(bounds, rowBoundary{[]RichTextSegment{seg}, reuse, low, high, !full})
reuse++
*/
} else if trunc == fyne.TextTruncateClip {
high = binarySearch(widthChecker, low, high)
bounds = append(bounds, rowBoundary{[]RichTextSegment{seg}, reuse, low, high, false})
Expand Down

0 comments on commit d08dc42

Please sign in to comment.