zed icon indicating copy to clipboard operation
zed copied to clipboard

Make `alt-left` and `alt-right` skip punctuation like Mac OS default behaviour

Open remorses opened this issue 7 months ago • 1 comments

Closes https://github.com/zed-industries/zed/discussions/25526

Release Notes:

  • Make alt-left and alt-right skip 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.

@notpeter

remorses avatar May 04 '25 12:05 remorses

I just noticed the Mac behaviour also skips consecutive punctuation characters if they are in the first position, which would require a refactoring compared to this PR approach, instead it should keep a variable isPunctuation and skip until it’s no longer punctuation

remorses avatar May 08 '25 12:05 remorses

@remorses Sorry for the slow review here!

I think it would be good to match macOS here if we can, but I don't think we should change the API of find_boundary, instead we can inline that code into the (one?) caller that cares about this.

ConradIrwin avatar Jun 03 '25 04:06 ConradIrwin

Opening a new PR with a simpler approach

remorses avatar Jun 03 '25 13:06 remorses