mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
ide: Find all optimized
git-svn-id: svn://ultimatepp.org/upp/trunk@10956 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5abe71dbe6
commit
2470dec05b
2 changed files with 10 additions and 4 deletions
|
|
@ -245,8 +245,8 @@ void CodeEditor::FindAll()
|
|||
while(FindFrom(foundpos, false, true)) {
|
||||
found.Add(MakeTuple(foundpos, foundsize));
|
||||
foundpos += foundsize;
|
||||
if(found.GetCount() >= 1000) {
|
||||
Exclamation("Too many matches, only first 1000 will be shown.");
|
||||
if(found.GetCount() >= 10000) {
|
||||
Exclamation("Too many matches, only first 10000 will be shown.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ void Ide::AddFoundFile(const String& fn, int ln, const String& line, int pos, in
|
|||
f.message = "\1" + EditorSyntax::GetSyntaxForFilename(fn) + "\1" +
|
||||
AsString(pos) + "\1" + AsString(count) + "\1" + line;
|
||||
ffound.Add(fn, ln, f.message, RawToValue(f));
|
||||
ffound.Sync();
|
||||
}
|
||||
|
||||
bool Ide::SearchInFile(const String& fn, const String& pattern, bool wholeword, bool ignorecase,
|
||||
|
|
@ -133,18 +132,22 @@ bool Ide::SearchInFile(const String& fn, const String& pattern, bool wholeword,
|
|||
bool wb = wholeword ? iscid(*pattern) : false;
|
||||
bool we = wholeword ? iscid(*pattern.Last()) : false;
|
||||
int infile = 0;
|
||||
bool sync = false;
|
||||
while(!in.IsEof()) {
|
||||
String line = in.GetLine();
|
||||
bool bw = true;
|
||||
int count;
|
||||
if(regexp) {
|
||||
if(regexp->Match(line))
|
||||
if(regexp->Match(line)) {
|
||||
AddFoundFile(fn, ln, line, regexp->GetOffset(), regexp->GetLength());
|
||||
sync = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
for(const char *s = line; *s; s++) {
|
||||
if(bw && Match(pattern, s, we, ignorecase, count)) {
|
||||
AddFoundFile(fn, ln, line, int(s - line), count);
|
||||
sync = true;
|
||||
infile++;
|
||||
n++;
|
||||
break;
|
||||
|
|
@ -154,6 +157,9 @@ bool Ide::SearchInFile(const String& fn, const String& pattern, bool wholeword,
|
|||
ln++;
|
||||
}
|
||||
|
||||
if(sync)
|
||||
ffound.Sync();
|
||||
|
||||
in.Close();
|
||||
int ffs = ~ff.style;
|
||||
if(infile && ffs != STYLE_NO_REPLACE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue