You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This looks good, but one thing I noticed is that the replace begins on the next occurrence after the text you initially selected. It loops back around eventually, but the text you had selected will always be last to get replaced. This bug already existed, of course, but your change makes it easier to hit since there's now an incentive to have some text selected.
I think you can fix this by changing line 225 from cm.getCursor() to cm.getCursor(true) (i.e., always begin at the start of the selection, instead of whichever end the cursor was left at). Can you test this out and add it to your pull request if it works?
Yes, I noticed that as well, but as it was already happening in master and is stated in the comments at the top I thought about trying to solve it separately...
Something similar happens if you have the cursor in the middle of a word (no selection) which looks strange to me. However, I've been testing it and Sublime2 does exactly the same.
@peterflynn I've tested your solution and setting cm.getCursor(true) does fix this indeed. Do you also want me to take out or update the Replace works a little oddly [...] comment at the top?
After reading it again, I think the comment I was quoting refers to the find-next in general, which still works like that. This could also be fixed by setting cm.getCursor(true) in line 151 inside doSearch. I could push it here as well, but maybe it makes more sense to create a differente pull request. What do you think?
@jbalsas: I actually think that comment is no longer correct even before your change, so we should probably just remove it. It originates from a very old version of the file, where it looks like Find and Replace were much more entangled. In more recent versions of the code, findNext() never does any replacement.
But we can do that cleanup later -- I'm happy to merge this pull request now.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepopulates the replace input with the current editor selection.
This pull request replaces #1962 following @peterflynn suggestions.