Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stop_at_first_char option to the move/select/delete to beginning of line actions #25346

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

felixpackard
Copy link

Closes #7863

In order to make the behaviour of similarly named "[x] to beginning of line" actions consistent, I've added the stop_at_first_char option which, if enabled, will treat the first non-whitespace character as the start of the line, and otherwise will treat the first character (whitespace or otherwise) as the start. This option defaults to false, as based on my testing the default behaviour in VS Code, Vim, and Emacs is to use the "true" start of the line as opposed to the first non-whitespace character.

This option essentially overrides the stop_at_soft_wraps option if enabled, as if the movement::indented_line_beginning method is called with a stop_at_soft_wraps value of false, the actual line start will always be returned, rather than the indented line start. This feels somewhat counterintuitive, so if there's a better way I should be handling the case where stop_at_soft_wraps is false and stop_at_first_char is true, I'd be happy to implement it.

I've tried to be thorough with test cases, and I've included the new option in the default keymaps everywhere that the stop_at_soft_wraps option is specified, but it's entirely possible I've missed something, with this being my first contribution to the project. I'm always open to feedback and happy to pair.

Release Notes:

  • Added stop_at_first_char option to the move/select/delete to beginning of line actions

make move/select/delete to beginning of line actions consistent with other beginning of line actions by adding a `stop_at_first_char` option

closes zed-industries#7863
Copy link

cla-bot bot commented Feb 21, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @felixpackard on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@felixpackard
Copy link
Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 21, 2025
Copy link

cla-bot bot commented Feb 21, 2025

The cla-bot has been summoned, and re-checked this pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate Beginning of Line and Beginning of None Whitespace Character
1 participant