editor: Treat single punctuation as a word boundary (#58882)

## Context

`next_word_end` and `previous_word_start` have a special case that skips
a punctuation character so that word movement treats the punctuation as
a part of the word (`|.foo` -> `.foo|`). But the check only looked at
whether the next char was punctuation, not whitespace, so it skipped
single punctuation marks.

	foo |. bar -> foo . bar| (should be `foo .| bar`)

Fix: only skip the punctuation when it's next to a word char.

Closes #55601

## How to Review

In any buffer, type `foo . bar`:

- Cursor before `.`, alt-right -> stops after the `.` (`foo .| bar`),
not at the end of `bar`.
- Cursor after `.`, alt-left -> stops before the `.` (`foo |. bar`).

##  Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed word movement skipping single punctuation characters surrounded
by whitespace.

---------

Co-authored-by: Martin Ye <martin@zed.dev>
Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
482963d5e9Maja Backman committed on 7/22/2026, 9:00:52 PM· committed by GitHubparentac44e9f
1 file changedLine totals unavailable