From 869e4879e87eebf37933f650366e5ad95e343c46 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 23 Jun 2015 19:30:25 +0000 Subject: [PATCH] ide: Navigator sorting improved #1133 git-svn-id: svn://ultimatepp.org/upp/trunk@8586 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/src.tpp/HttpRequest$en-us.tpp | 4 ++- uppsrc/ide/Assist.h | 2 +- uppsrc/ide/Navigator.cpp | 41 ++++++++++++----------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/uppsrc/Core/src.tpp/HttpRequest$en-us.tpp b/uppsrc/Core/src.tpp/HttpRequest$en-us.tpp index 79058d682..012631c66 100644 --- a/uppsrc/Core/src.tpp/HttpRequest$en-us.tpp +++ b/uppsrc/Core/src.tpp/HttpRequest$en-us.tpp @@ -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]()&] diff --git a/uppsrc/ide/Assist.h b/uppsrc/ide/Assist.h index 20d544ae7..ebbc4314e 100644 --- a/uppsrc/ide/Assist.h +++ b/uppsrc/ide/Assist.h @@ -31,7 +31,7 @@ struct Navigator { int decl_file; bool impl; bool decl; - bool pass; + int8 pass; Vector linefo; void Set(const CppItem& m); diff --git a/uppsrc/ide/Navigator.cpp b/uppsrc/ide/Navigator.cpp index d3e3a5ff6..44f76a5f3 100644 --- a/uppsrc/ide/Navigator.cpp +++ b/uppsrc/ide/Navigator.cpp @@ -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 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& 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 sc; + Vector keys = gitem.PickKeys(); + Vector > values = gitem.PickValues(); + IndexSort(keys, values); + for(int i = 0; i < keys.GetCount(); i++) + keys[i].Remove(0); + gitem = pick(VectorMap > (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()); }