Sublime Forum

Find/replace "wrap" not working right?

#1

Unless I misunderstand…

I create a find/replace using a GREP which I want to perform on my document from the cursor position to end of document.

No other find options are on.

Replace all, and ALL the matches change, even those above the cursor. Shouldn’t that only happen if I chose “wrap”?

0 Likes

#2

I can confirm this - Replace All definitely does not obey Wrap setting - it replaces all instances throughout the whole document.

This is with the latest ST3 beta build.

Please fix, it’s annoying :smile:

0 Likes

#3

Nobody can reproduce? I sure can…

0 Likes

#4

I think this is by design; the wrap toggle is for find only. I agree that it should be better. SnR could get a number of improvements in Sublime; my other editor is far more flexible in this regard. I’m also not a fan of the behaviour when doing replace across lots of files - ie. Sublime opens them all in tabs, and they all need saving.

0 Likes

#5

Is this ever going to be fixed? It’s annoying as hell (and makes absolutely no sense whatsoever!) that wrap is not respected when replacing text!

0 Likes

#6

So I guess this is never getting fixed, eh? :confused:

0 Likes

#7

Really, really disappointed that this is still not being fixed/changed/option added.

0 Likes

#8

If you only want to replace the visible text on the screen, you need to select it all the visible text before the wrap and mark the option In Selection.

0 Likes

#9

No, that is not what I want. I want find/replace to respect the Wrap setting. As it is, as soon as you do Replace All with Wrap disabled, it will replace everything in the document, rather than replacing everything from the current cursor to the end of the document (which is what I would expect it to do, based on Wrap being disabled).

If Notepad++ can do it, why can’t Sublime?

0 Likes

#10

Seems a odd behavior for the wrap setting.

What you can do now is instead of using the wrap setting:

  1. Put the cursor where you would like to start replacing
  2. Press Ctrl+Shift+End
  3. Pres Ctrl+H
  4. Select the option In Selection
  5. Press Replace All or Ctrl+Alt+Enter

If it still not enough, open a feature request on https://github.com/SublimeTextIssues/Core/issues and wait until they implement it (may be never). If you would not like to wait, you can keep using Notepad++. But, if you need a multiplatform editor, you can try some other editor as VSCode, which is open source and you can implement this feature, by yourself, if it is not already implemented, and you would not like to wait for someone else implement it:
https://github.com/Microsoft/vscode

0 Likes

#11

I depend on Sublime because of a particular extension that exists only for Sublime. So, N++ or any other text editor is not an option.

I know how to use the “In selection” option, but it’s slowing down workflow. I’m just saying it doesn’t make sense to me to first do the selection in order to just replace stuff till the end of document without wrapping around (which is what Wrap option for find/replace is supposed to do - but it only works for find, instead of also working for replace), something that is logical in other text editors (well, at least N++, but I’m sure some other editors also behave this way).

1 Like

#12

You are right, the behavior is bugged. I did not had understood correctly the issue before. I was confusing it with the word-wrap feature. You should open an issue reporting it on the issue tracker, if it is not already reported. Sublime Text is very slow in fixing old bugs, if not completely halt. You are better recreating your dependent extension on some other editor where things can get fixed. I am also trying to move out from Sublime Text because of these old issues which seem to never get fixed, while new features keep being added.

0 Likes

#13

Yeah, unfortunately I did not write that extension, somebody else did. And I’m not that well-versed with Python to just port it to something else. :frowning:

0 Likes