Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » TheIDE Find/Replace
Re: TheIDE Find/Replace [message #25043 is a reply to message #25042] Tue, 09 February 2010 09:01 Go to previous messageGo to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
koldo wrote on Tue, 09 February 2010 07:52

Hello Mirek

Thank you for your improvements in the editor.

Now Ctrl-F has two behaviors:
- If no text is selected, it finds text
- If text is selected, it does a "Replace in Selection"

Is it a way to configure Ctrl-F for acting always as find text ?

Just to ask something additional Smile, it would be useful if Ctrl-F (and Ctrl-Shift-F) would search for the selected text.



long time ago I was tired of pressing Ctrl_I to have inserted selected text into FindInFiles... so my version looks like this:

void Ide::FindInFiles() {
	StringStream ss;
	editor.SerializeFind(ss);
	ss.Open(ss.GetResult());
	SerializeFf(ss);
	String findsel = editor.IsSelection()? editor.GetSelection() : editor.GetWord();//aris002
	if (!findsel.IsEmpty()){
		ff.find<<= findsel;
		ff.find.AddHistory();
	}
	
	if(String(ff.folder).IsEmpty())
		ff.folder <<= GetUppDir();
	ff.style <<= STYLE_NO_REPLACE;
	ff.itext = editor.GetI(); //aris002 should not use this at at all? or find 1more way?
	int c = ff.Execute();
	ss.Create();
	SerializeFf(ss);
	ss.Open(ss.GetResult());
	editor.SerializeFind(ss);
	if(c == IDOK && !String(ff.find).IsEmpty()) {
		Renumber();
		ff.find.AddHistory();
		ff.files.AddHistory();
		ff.folder.AddHistory();
		ff.replace.AddHistory();

		Progress pi("Found %d files to search.");
		Vector<String> files;
		SearchForFiles(files, NormalizePath((String)ff.folder, GetUppDir()), ~ff.files, pi);
		if(!pi.Canceled()) {
			String pattern;
			if(ff.wildcards) {
				String q = ~ff.find;
				for(const char *s = q; *s; s++)
					if(*s == '\\') {
						s++;
						if(*s == '\0') break;
						q.Cat(*s);
					}
					else
					switch(*s) {
					case '*': pattern.Cat(WILDANY); break;
					case '?': pattern.Cat(WILDONE); break;
					case '%': pattern.Cat(WILDSPACE); break;
					case '#': pattern.Cat(WILDNUMBER); break;
					case '$': pattern.Cat(WILDID); break;
					default:  pattern.Cat(*s);
					}
			}
			else
				pattern = ~ff.find;
			pi.SetTotal(files.GetCount());
			ShowConsole();
			console.Clear();
			pi.SetPos(0);
			int n = 0;
			for(int i = 0; i < files.GetCount(); i++) {
				pi.SetText(files[i]);
				if(pi.StepCanceled()) break;
				if(!SearchInFile(files[i], pattern, ff.wholeword, ff.ignorecase, n))
					break;
			}
			console << Format("%d occurrence(s) have been found.\n", n);
		}
	}
	SetErrorEditor();
}


it selects a word where the caret is. Should work if I haven't missed anything else
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: RapidSVN vs Ultimate SVN fuctionality
Next Topic: CodeEditor current caret position mark on gutter
Goto Forum:
  


Current Time: Wed May 15 12:01:26 CEST 2024

Total time taken to generate the page: 0.03215 seconds