-
Notifications
You must be signed in to change notification settings - Fork 23
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
Implement string-inflect-final-position
#43
Conversation
* New final point behavior when using a region * The region remains active after the inflection. That means the -cycle- operations now actually work with regions.
Thank you for the pull request. I set string-inflection-final-position to 'remain and have been using it for a bit.
After calling string-inflection-ruby-style-cycle, the result is:
The cursor ends up here, which interrupts continuous transformations. The correct behavior should be:
or
This is the only part that concerns me. |
I am trying to convert a full file path with underscore notation to a class name.
I am running this within org-mode. It works correctly in ruby-mode. |
When the cursor is at the end of a shortened string and final pos is to `'remain`, the cursor will be after the inflection one position too far ``` foo_bar foo ↕ cursor position fooBar foo ``` Fix is to not always strictly remain but moving to the end of symbol when necessary.
Thanks for the catch, nice find. The problem is that if the cursor is at the end of the inflected symbol and after the inflection the inflected string is shortened remaining means actually that we end up one char too far. 8ad5b9d fixes this. |
The problem here is that Thanks for the catch. I will look for a solution. |
Thank you for the fix. It's working smoothly now. |
This turns out to be way trickier. We could adjust the Moreover, in such a complex symbol there always rises the question, which kind of case "wins". Consider for example
Is it undescore, camel case or kebab case? And this can be taken further for programming modes when there is a symbol named I don't think we should introduce all that much complexity for these kind of edge cases, but I'd like to suggest a possible feature to work around that. We could use a region not only to extend the operation space to multiple symbols but also to restrict it to a substring of a symbol
would cycle to
would cycle to That would also work around the issue of |
While the range selection might be slightly cumbersome, it also offers the advantage of partial conversion. Therefore, let's proceed with this method for selecting the range. |
Implemented the partial conversion behavior in 2612de8. |
Thank you for the implementation. |
Closes #42
This introduces
string-inflect-final-position
as proposed in #42. Along with this the behavior for(use-region-p)
has been improved. When a region is active the inflection operation now does the following:-cycle-
operations now make sense.