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 across files corrupts files with CR line endings #48063

Open
AArnott opened this issue Apr 17, 2018 · 3 comments
Open

Search and replace across files corrupts files with CR line endings #48063

AArnott opened this issue Apr 17, 2018 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member search Search widget and operation issues
Milestone

Comments

@AArnott
Copy link
Member

AArnott commented Apr 17, 2018

Issue Type: Bug

Execute these commands:

git clone https://github.com/AArnott/pinvoke.git
cd pinvoke
git checkout b1239bc075f87f202a410973d7faa468a5e6b9cf
code .

In the Search panel, search for "LICENSE.txt" and replace with "LICENSE" (no other options such as regex are selected).

In the search and replace results (before commiting them), notice how the second line of most source files has a small change applied. This is good.
But notice how 4 files have an erroneous change applied to the first line:

  • src/User32/User32+DLGITEMTEMPLATE.cs
  • src/User32/User32+DLGTEMPLATE.cs
  • src/User32/User32+MSG.cs
  • src/User32/User32+PeekMessageRemoveFlags.cs

VS Code version: Code 1.22.1 (950b8b0, 2018-04-06T02:26:57.615Z)
OS version: Windows_NT x64 10.0.16299

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 x 2112)
Memory (System) 15.93GB (2.72GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe .
Screen Reader no
VM 0%
Extensions (16)
Extension Author (truncated) Version
vscode-markdownlint Dav 0.14.1
githistory don 0.4.0
xml Dot 1.9.2
gitlens eam 8.2.1
EditorConfig Edi 0.12.1
git-project-manager fel 1.5.1
docker-linter hen 0.5.0
docomment k-- 0.0.18
azure-account ms- 0.4.0
cpptools ms- 0.16.1
csharp ms- 1.14.0
PowerShell ms- 1.6.0
team ms- 1.133.0
vscode-docker Pet 0.0.26
java red 0.23.0
vsc-docker Zim 0.34.0
@vscodebot vscodebot bot added the search Search widget and operation issues label Apr 17, 2018
@roblourens
Copy link
Member

It looks like those files have CR-only line endings, which we don't support well: #35797

@roblourens roblourens added the *duplicate Issue identified as a duplicate of another issue(s) label Apr 18, 2018
@AArnott
Copy link
Member Author

AArnott commented Apr 18, 2018

How do line endings impact this? I'm not talking about how line endings may have been munged by the search and replace. I'm talking about how instead of replacing "LICENSE.txt" with "LICENSE", it replaced an entire line that didn't even include "LICENSE.txt" on it.

@roblourens
Copy link
Member

The search tool doesn't consider them line endings, so it reports a match on line 1, and the editor clobbers the CR line endings, and things are out of sync... looking at the code again, I can handle it in a less destructive way, either by not reporting the match or not applying the replace.

@roblourens roblourens reopened this Apr 18, 2018
@roblourens roblourens added bug Issue identified by VS Code Team member as probable bug and removed *duplicate Issue identified as a duplicate of another issue(s) labels Apr 18, 2018
@roblourens roblourens added this to the On Deck milestone Sep 13, 2018
@roblourens roblourens changed the title Search and replace across files corrupts some files that include + in their filename Search and replace across files corrupts files with CR line endings Sep 13, 2018
@roblourens roblourens modified the milestones: On Deck, Backlog Dec 13, 2022
@andreamah andreamah assigned andreamah and unassigned roblourens Dec 15, 2022
@andreamah andreamah added the confirmed Issue has been confirmed by VS Code Team member label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member search Search widget and operation issues
Projects
None yet
Development

No branches or pull requests

3 participants