Make `alt-left` and `alt-right` skip punctuation like macOS default behavior
Closes https://github.com/zed-industries/zed/discussions/25526 Follow up of #29872
Release Notes:
- Make
alt-leftandalt-rightskip punctuation on Mac OS to respect the Mac default behaviour. When pressing alt-left and the first character is a punctuation character like a dot, this character should be skipped. For example:hello.|goes to|hello.
This change makes the editor feels much snappier, it now follows the same behaviour as VSCode and any other Mac OS native application.
@ConradIrwin
Great, thank you!
I think we should do this on all platforms, and can you please add a test
Added some tests and enabled this new behaviour for all platforms.
Ok turns out different apps behave differently on Mac:
- The default Mac OS behaviour for apps like Notes is very weird, it skips a full sequence of punctuation characters, for example pressing
alt+lefton|...wordgoes to...word|which can be unexpected - VSCode instead only skips the first punctuation character, for example
|...wordgoes to...|word(just like Zed now) but|.wordgoes to.word|(not like Zed)
I decided to go with VSCode behaviour which is the most popular and familiar one. It still makes the IDE feels much snappier but does not do unexptected things like skip a long series of punctuation characters
I fixed the tests to align to the new behaviour
not sure if intended, but the behavior diverges from VSCode?
pub struct Example {
first: u32|,
second: u32,
}
goes to
pub struct Example {
first: u32,
second|: u32,
}
whereas VSCode would have
pub struct Example {
first: u32,|
second: u32,
}
@npm-hater can you open an issue, i can open a PR later, the code needs an additional \n check