Skip to content

Commit

Permalink
Move color out of loop and fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jan 6, 2024
1 parent ed31585 commit 792b8de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions widget/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,8 @@ func (r *entryContentRenderer) Refresh() {
r.content.entry.propertyLock.RLock()
provider := r.content.entry.textProvider()
placeholder := r.content.entry.placeholderProvider()
focusedAppearance := r.content.entry.focused && !r.content.entry.disabled
focused := r.content.entry.focused
focusedAppearance := focused && !r.content.entry.disabled
selections := r.selection
r.updateScrollDirections()
r.content.entry.propertyLock.RUnlock()
Expand All @@ -1863,10 +1864,11 @@ func (r *entryContentRenderer) Refresh() {
}
r.moveCursor()

selectionColor := theme.SelectionColor()
for _, selection := range selections {
rect := selection.(*canvas.Rectangle)
rect.Hidden = !r.content.entry.focused
rect.FillColor = theme.SelectionColor()
rect.Hidden = !focused
rect.FillColor = selectionColor
}

canvas.Refresh(r.content)
Expand Down

0 comments on commit 792b8de

Please sign in to comment.