Bug 1925 - "Replace in Files" does not work for "selection", replaces in the entire document
Summary: "Replace in Files" does not work for "selection", replaces in the entire docu...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 2.8.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2011-11-08 01:27 UTC by Atsushi Eno
Modified: 2012-02-27 03:01 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Atsushi Eno 2011-11-08 01:27:11 UTC
Create a C# project, edit text like this:

using System;

namespace MonoDroid.Generation
	public class test
		public test ()
	// end

	string contest;

Then select the text from "public class" to "// end", open Replace in Files command and enter "test" and "Test" as the source and substitute strings, then run the command. It replaces the entire text and you'll see "conTest".

This used to work, I used it on Linux, but since now I only have a Mac I can test, I'm not sure if it used to work on that OS.
Comment 1 Jeffrey Stedfast 2012-02-23 15:57:07 UTC
This seems to be because of this:

commit 1a9d60f3f214845c99d83b655e0411048d27bb74

I'm not clear why that was done...
Comment 2 Mike Krüger 2012-02-24 01:40:17 UTC
That's because most people got annoyed that "selection" is auto selected when they want to search something in the whole project (and just have selected something).

Search in selection is something most people don't want to do, that's why it was done.

If you set "Selection" in the look in combo it'll work.
Comment 3 Atsushi Eno 2012-02-24 04:30:33 UTC
Wait, are you really sure that "search in selection is something most people don't want to do" ? Where can I get the source of that collected opinions? I never preferred a code editor that don't support that feature in the past.
Comment 4 Mike Krüger 2012-02-24 07:09:47 UTC
I had a bug open about:

Monodevelop alwas selects some weird stuff in the find in files dialog. And I had to agree with that report more than with that one - it happened for me from time to time. 

You can move the discussion the monodevelop mailing list. But these feature is exclusive - either it's in or it's out. Atm my desision is more to "out". 

You still can search in selection - it's 1 action more, since it's a seldom used feature it's ok. But find in files is more often used than that and most people don't want to deselect that - all "autoselect" features share that issue.

It's the same with the auto selection of case sensitivity - auto selection shouldn't be done unless you have a very, very good reason for it. And no, atm I can't really see it in the find in selection feature. But maybe a discussion on the mailing list may change my mind.

We may have even an option for it - if it's important enough.
Comment 5 Atsushi Eno 2012-02-24 07:35:46 UTC
Oh, I guess we both are talking about different things than my original report (obviously my bad on my misunderstanding part). I was not complaining about "why do I have to choose 'find in files' command just to search within the selection in current file" thing.
My report is rather about that the Find in Files command, with "selection" option in the combo box, still doesn't work correctly. It replaces text *outside* the selection.

(I noticed that this "replace in selection" does not actually replace any text that *precedes* the selection range. Any text that *follows* the selection range are replaced.)
Comment 6 Mike Krüger 2012-02-27 03:01:15 UTC
Oh my fault :/

bug fixed.