Fix `closest_index_for_x` to get correct offset when only 1 char (#23603)
Jason Lee
created
Release Notes:
- N/A
----------
This bug can easy to replay by `input` example, just enter 1 char and
click on the middle of the char, we can't move cursor to 0, it is always
be 1.
```bash
cargo run -p gpui --example input
```
## Before
https://github.com/user-attachments/assets/3239dd47-278e-4311-9757-5165d1ccd796
## After
https://github.com/user-attachments/assets/4e2c1500-0142-4e28-bf34-7ef1f4929925