ide: Navigator sorting improved #1133

git-svn-id: svn://ultimatepp.org/upp/trunk@8586 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-06-23 19:30:25 +00:00
parent 876a1f25d9
commit 869e4879e8
3 changed files with 26 additions and 21 deletions

View file

@ -103,7 +103,9 @@ is used as method. Returns `*this.&]
[s3;%% &]
[s4; &]
[s5;:HttpRequest`:`:DEL`(`): [_^HttpRequest^ HttpRequest][@(0.0.255) `&]_[* DEL]()&]
[s2;%% Same as Method(METHOD`_DELETE). Returns `*this.&]
[s2;%% Same as Method(METHOD`_DELETE). Returns `*this. Note that
this method is not named `"DELETE`" because of name`-clash with
Win32 #define.&]
[s3; &]
[s4; &]
[s5;:HttpRequest`:`:TRACE`(`): [_^HttpRequest^ HttpRequest][@(0.0.255) `&]_[* TRACE]()&]

View file

@ -31,7 +31,7 @@ struct Navigator {
int decl_file;
bool impl;
bool decl;
bool pass;
int8 pass;
Vector<NavLine> linefo;
void Set(const CppItem& m);

View file

@ -4,8 +4,6 @@
String FormatNest(String nest)
{
if(*nest == '~')
nest = nest.Mid(1);
int q = nest.Find("@");
if(q >= 0) {
nest.Trim(q);
@ -66,8 +64,6 @@ int PaintFileName(Draw& w, const Rect& r, String h, Color ink)
{
if(*h == '\xff')
h.Remove(0, 1);
if(*h == '~')
h.Remove(0, 1);
return DrawFileName0(w, r, h, ink, 0);
}
@ -416,18 +412,16 @@ void Navigator::NavGroup(bool local)
String g = m.nest;
if(m.kind == TYPEDEF)
g.Trim(max(g.ReverseFind("::"), 0));
if(IsNull(g) || CodeBase().namespaces.Find(g) >= 0) {
if(IsNull(m.nest) || CodeBase().namespaces.Find(m.nest) >= 0) {
if(g.GetCount()) // We want to show the namespace
g = g + '\xff';
g << GetSourceFilePath(m.decl_file);
if(m.pass)
g = "\xff~" + g; // Second pass contains less matching items, sort it after the first pass
g << '\xff';
else
g = "\xff" + g;
g.Clear();
g << GetSourceFilePath(m.decl_file);
g = '\xff' + g;
}
else
if(m.pass)
g = "~" + g; // Second pass contains less matching items, sort it after the first pass
if(!local)
g = (char)(m.pass + 10) + g;
if(local)
if(gitem.GetCount() && gitem.TopKey() == g)
gitem.Top().Add(&m);
@ -522,15 +516,17 @@ void Navigator::Search()
String usearch_name = ToUpper(search_name);
ArrayMap<String, NavItem> imap;
bool local = sorting && IsNull(s);
for(int pass = 0; pass < 2; pass++) {
for(int pass = -1; pass < 2; pass++) {
for(int i = 0; i < b.GetCount(); i++) {
String nest = b.GetKey(i);
// bool foundnest = (wholeclass ? ToUpper(nest) == search_nest
// : ToUpper(nest).Find(search_nest) >= 0) && *nest != '@';
bool foundnest = (wholeclass ? pass ? ToUpper(nest) == usearch_nest
bool foundnest = (wholeclass ? pass < 0 ? false :
pass ? ToUpper(nest) == usearch_nest
: nest == search_nest
: (pass ? ToUpper(nest).Find(usearch_nest) >= 0
: nest.Find(search_nest) >= 0))
: pass < 0 ? nest == search_nest :
(pass ? ToUpper(nest).Find(usearch_nest) >= 0
: nest.StartsWith(search_nest)))
&& *nest != '@';
if(local || foundnest || both) {
const Array<CppItem>& ci = b[i];
@ -538,7 +534,8 @@ void Navigator::Search()
const CppItem& m = ci[j];
// if(local ? m.file == fileii : *m.uname != '@' && m.uname.Find(search_name) >= 0 || both && foundnest) {
if(local ? m.file == fileii
: *m.uname != '@' && (pass ? m.uname.Find(usearch_name) >= 0
: *m.uname != '@' && (pass < 0 ? m.name == search_name :
pass ? m.uname.Find(usearch_name) >= 0
: m.name.StartsWith(search_name))
|| both && foundnest) {
String key = nest + '\1' + m.qitem;
@ -579,7 +576,12 @@ void Navigator::Search()
nitem = imap.PickValues();
NavGroup(false);
SortByKey(gitem);
Index<String> sc;
Vector<String> keys = gitem.PickKeys();
Vector<Vector<NavItem *> > values = gitem.PickValues();
IndexSort(keys, values);
for(int i = 0; i < keys.GetCount(); i++)
keys[i].Remove(0);
gitem = pick(VectorMap<String, Vector<NavItem *> > (keys, values));
for(int i = 0; i < gitem.GetCount(); i++)
Sort(gitem[i], sorting ? SortByNames : SortByLines);
}
@ -657,6 +659,7 @@ void Navigator::Scope()
litem.Add(m);
}
}
list.Clear();
list.SetVirtualCount(litem.GetCount());
}