The logic to handle word selection from double clicking ran even when the event wasn't inside the button. This would pass an invalid position to BLI_str_cursor_step_bounds_utf8 which hung. Resolve by limiting word-selection to when the event is inside the text editing field as well as clamping the position to ensure it's within the allowed range.