-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Include underscore in subword regex #7658
Comments
Just for future reference, it's totally fine to open a PR and discuss on the PR itself instead of opening a separate issue for discussion first. (In some ways it's a lot easier that way.) |
Right now, Atom is going to stop before the underscore and after. That is what I was trying to point out. Do you like how Sublime does it? |
@dsandstrom I'm just trying to understand what you'd like and why. To understand that, it's helpful to have the facts straight and the desired behavior clearly explained. Can you edit your example above, or provide a new example which clearly demonstrates step-by-step the behavior you would like to see? From your original issue, it is not clear which behavior exactly you would like to see and which of the options is better (because the option you said users would be used to from Sublime Text isn't actually the current behavior there as far as I can tell). |
I edited the original example and included a third option. To be honest, I don't have a huge preference. However, after seeing your gif, I think I prefer option 3. It requires only two keystrokes to get to the end and seems more delete friendly. |
I went with Option 3, the one demonstrated by @izuzak's gif. |
I'm currently facing this issue in atom/vim-mode#769, so your PR #7859 will be appreciated! For what it's worth, I would've also agreed that option 3 is the way to go, because if you replace the underscore with a space and move right, say with Ctrl-➡, it would act similarly to option 3. Also, without this change, when there is no camel or snake casing, moving by subwords is inconsistent with moving by words (i.e. moving with Ctrl + arrows vs moving with Alt + arrows). I don't think there's a reason for having them act inconsistent in this case. |
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks! |
Similarly to #7656, this is a change I made after the Atom PR. When going left or right, the cursor should skip over the underscore.
Example (edited)
If the cursor starts on the left, and going right:
Option 1) How it is now:
go right again
go right again
Option 2)
go right again
Option 3) More Sublime like:
go right again
I don't have a good argument for either case. Sublime Text uses Option 2 so it is probably what people are used to. Option 1 is useful when deleting subwords to change the variable text. However, Option 2 saves keystrokes in most cases.
I'm willing to make the fix, but wanted to get a issue started if discussion is required.
https://github.com/dsandstrom/atom-subword-navigation/blob/b579b03bb95e6a2cdb634a7411b40cb29bd6c5c4/lib/subword-navigation.coffee#L62
The text was updated successfully, but these errors were encountered: