Skip to content

Commit ac3eeb3

Browse files
authored
Merge pull request #5655 from andydotxyz/fix/5652
Correctly pass the text style to calculations
2 parents a6e8ea7 + fcfcd38 commit ac3eeb3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

widget/selectable.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ func (s *selectable) cursorColAt(text []rune, pos fyne.Position) int {
184184

185185
for i := 0; i < len(text); i++ {
186186
str := string(text[0:i])
187-
wid := fyne.MeasureText(str, textSize, fyne.TextStyle{}).Width // todo e.TextStyle
188-
charWid := fyne.MeasureText(string(text[i]), textSize, fyne.TextStyle{}).Width // todo e.TextStyle
187+
wid := fyne.MeasureText(str, textSize, s.style).Width
188+
charWid := fyne.MeasureText(string(text[i]), textSize, s.style).Width
189189
if pos.X < innerPad+wid+(charWid/2) {
190190
return i
191191
}
@@ -198,7 +198,7 @@ func (s *selectable) getRowCol(p fyne.Position) (int, int) {
198198
textSize := th.Size(s.getSizeName())
199199
innerPad := th.Size(theme.SizeNameInnerPadding)
200200

201-
rowHeight := s.provider.charMinSize(false, fyne.TextStyle{}, textSize).Height // TODO (e.Password, e.TextStyle, textSize).Height
201+
rowHeight := s.provider.charMinSize(false, s.style, textSize).Height // TODO handle Password
202202
row := int(math.Floor(float64(p.Y-innerPad+th.Size(theme.SizeNameLineSpacing)) / float64(rowHeight)))
203203
col := 0
204204
if row < 0 {

0 commit comments

Comments
 (0)