8000 Include underscore in subword regex · Issue #7658 · atom/atom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Include underscore in subword regex #7658

Closed
dsandstrom opened this issue Jul 2, 2015 · 8 comments
Closed

Include underscore in subword regex #7658

dsandstrom opened this issue Jul 2, 2015 · 8 comments

Comments

@dsandstrom
Copy link
Contributor

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:

|my_variable

Option 1) How it is now:

my|_variable

go right again

my_|variable

go right again

my_variable|

Option 2)

my_|variable

go right again

my_variable|

Option 3) More Sublime like:

my|_variable

go right again

my_variable|

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

@mnquintana
Copy link
Contributor

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.)

@izuzak
Copy link
Contributor
izuzak commented Jul 10, 2015

I don't have a good argument for either case. Sublime Text uses Option 2 so it is probably what people are used to.

That's strange. As far as I can tell, Sublime Text 3 is using Option 1.

sub

Which version of Sublime are you using?

@dsandstrom
Copy link
Contributor Author

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?

@izuzak
Copy link
Contributor
izuzak commented Jul 10, 2015

@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).

@dsandstrom
Copy link
Contributor Author

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.

@dsandstrom
Copy link
Contributor Author

I went with Option 3, the one demonstrated by @izuzak's gif.

@deiwin
Copy link
deiwin commented Jul 15, 2015

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.

@lock
Copy link
lock bot commented Jan 21, 2019

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!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants
0