Skip to content
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

Search and Replace in broken in files using only CR as line-ending #40908

Closed
W4RH4WK opened this issue Dec 28, 2017 · 7 comments
Closed

Search and Replace in broken in files using only CR as line-ending #40908

W4RH4WK opened this issue Dec 28, 2017 · 7 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster search Search widget and operation issues

Comments

@W4RH4WK
Copy link
Contributor

W4RH4WK commented Dec 28, 2017

  • VSCode Version: 1.19.1
  • OS Version: Windows 10 (1709)

It appears that there is a bug with the search and replace functionality. It is encountered when editing multiple XML files. I have recorded a screen capture to illustrate the issue.

https://youtu.be/ehuqer244S4

Content of one XML file:

<assets>
	<output mode="c" filename="../../../assetlist/_generated/I_NOTE_HELP000/header.h" rcname="../../../assetlist/_generated/I_NOTE_HELP000/assetR" fileList="g_fileNames" pathprefix="data/"/>
	<asset source="%ED8_PSV%/data/images/note/help/note_help000foo" symbol="I_NOTE_HELP000"/>
</assets>

Steps to Reproduce:

  1. Open a folder containing a bunch of XML files.
  2. Search and replace a string as shown in the video.
  3. Observe the changes done to the XML files.

Reproduces without extensions: Yes

@vscodebot vscodebot bot added the search Search widget and operation issues label Dec 28, 2017
@W4RH4WK W4RH4WK changed the title Search and Replace in multiple (xml) files broken Search and Replace in multiple (XML) files broken Dec 28, 2017
@roblourens
Copy link
Member

Weird. Great soundtrack though.

  • Could you upload one of the files here, in case it's an issue of hidden characters or an unusual encoding?
  • Can you show the output of the search output pane?

image

  • Does any query match the beginning of those files, or just that particular one?
  • Do you see these wrong matches in any other files?

@roblourens roblourens added the info-needed Issue requires more information from poster label Dec 28, 2017
@W4RH4WK
Copy link
Contributor Author

W4RH4WK commented Dec 28, 2017

Upon further investigation, yes it seems like it has something to do with the encoding. When I copy-paste the content from my first post to a new file, everything works as intended.

Here is one of the files with which I can reproduce this:
40908-1.zip

This is the output of search pane:

rg --hidden --heading --line-number --color 'ansi' --colors 'path:none' --colors 'line:none' --colors 'match:fg:red' --colors 'match:style:nobold' --ignore-case -g '!/Users/w4rh4wk/Desktop/help2/**/.git' -g '!/Users/w4rh4wk/Desktop/help2/**/.svn' -g '!/Users/w4rh4wk/Desktop/help2/**/.hg' -g '!/Users/w4rh4wk/Desktop/help2/**/CVS' -g '!/Users/w4rh4wk/Desktop/help2/**/.DS_Store' -g '!/Users/w4rh4wk/Desktop/help2/**/.stack-work' -g '!/Users/w4rh4wk/Desktop/help2/**/node_modules' -g '!/Users/w4rh4wk/Desktop/help2/**/bower_components' --max-filesize '17179869184' --follow --fixed-strings -- 'ass' 'c:\Users\w4rh4wk\Desktop\help2'
 - cwd: c:/
 - Sibling clauses: {}

Any pattern that matches at least once triggers this behavior it seems.
All of them match the beginning of the content.
Although, everything seems to be fine if that file is open in the editor.

So far this is the first time I encountered this issue, and it may indeed be due to the file encoding. I have not experienced this with other files.

PS: link to the soundtrack, artists are listed in the description.

@W4RH4WK
Copy link
Contributor Author

W4RH4WK commented Dec 28, 2017

It seems like it's because these files use only CR (\r) as line-endings.

@roblourens
Copy link
Member

That's right - there was another issue for this but I can't find it. We don't support CR-only line endings well in general - #35797, I'll call this a dupe of that for now.

Is that on purpose? I can't really tell how common it is.

@roblourens roblourens added the *duplicate Issue identified as a duplicate of another issue(s) label Dec 28, 2017
@vscodebot
Copy link

vscodebot bot commented Dec 28, 2017

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Dec 28, 2017
@W4RH4WK
Copy link
Contributor Author

W4RH4WK commented Dec 28, 2017

I don't think it is that common.

Whether this was intentional for these files I don't know.

@W4RH4WK W4RH4WK changed the title Search and Replace in multiple (XML) files broken Search and Replace in broken in files using only CR as line-ending Dec 28, 2017
@W4RH4WK
Copy link
Contributor Author

W4RH4WK commented Dec 28, 2017

Side note: It appears that mac OS used CR only as line-ending until version 9 (src: http://vim.wikia.com/wiki/File_format).

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster search Search widget and operation issues
Projects
None yet
Development

No branches or pull requests

2 participants