Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Multiline selections should be auto-converted Find/Replace in Files #8211

Closed
redmunds opened this issue Jun 20, 2014 · 7 comments
Closed

Multiline selections should be auto-converted Find/Replace in Files #8211

redmunds opened this issue Jun 20, 2014 · 7 comments

Comments

@redmunds
Copy link
Contributor

Multiple line search arguments are allowed for Find/Replace in Files, but they must be in regex format. Since search argument fields are pre-populated from current selection, it would be nice if newlines in selected text were converted to "\n" string instead of just being removed, and also on regex flag is turned on.

Also, we should think of a way to insert newlines via "replace with" text.

For example:

  1. Start with this text in page:

    aaa
    bbb
    ccc
    
  2. Select range starting with "aaa" and ending with "bbb"

  3. Find > Replace in Selected File/Folder

  4. The newline is removed from the selelction and the search argument is pre-populated to "aaabbb". Would be nice if the newline was replaced with "\n" so it was "aaa\nbbb". Also, regex flag should be turned on (if not on already)

  5. I'd also like to put something like "yyy\nzzz" in the "Replace With" field to have 2 lines inserted.

@TomMalbran
Copy link
Contributor

The search in files doesn't support multiline yet. So I think that that should land before this change.

@peterflynn
Copy link
Member

Reviewed. For now, let's just make Find/Replace in Files consistent with simple Find/Replace -- cutting off the prepopulated text at the first newline. Beyond that, we should wait for the full-fledged multi-line search/replace story.

@peterflynn
Copy link
Member

Marking 'starter bug' since the bug fix part of this (see previous comment) should be fairly simple. We basically just want the logic in FindReplace.openSearchBar() (where is says "Eliminate newlines") to be shared in FindInFilesUI._showFindBar() so both truncate initialQuery the same way.

@peterflynn
Copy link
Member

FBNC @redmunds

@redmunds
Copy link
Contributor Author

redmunds commented Aug 8, 2014

@peterflynn Confirmed that 'starter bug' part works as advertised. Should this issue remain open for remaining work?

@marcelgerber
Copy link
Contributor

@redmunds I don't think so as the remaining part is already a Trello card.

@peterflynn
Copy link
Member

Yep -- it's part of the existing Find/Replace: Allow matching across newlines story.

(I know the proposal above includes ways to sidestep around that by converting the user's string into a regexp automatically, but we talked about that in bug review and decided it wasn't worth doing until we get to the full story).

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