diff --git a/uppsrc/ide/Annotations.cpp b/uppsrc/ide/Annotations.cpp index 88f87165a..1ee2f4b76 100644 --- a/uppsrc/ide/Annotations.cpp +++ b/uppsrc/ide/Annotations.cpp @@ -56,14 +56,6 @@ bool AssistEditor::GetAnnotationRefs(Vector& tl, String& coderef, int q) return true; } -int BestMatch(const char *s, const char *t) -{ - int i = 0; - while(s[i] == t[i] && *s) - i++; - return i; -} - bool AssistEditor::GetAnnotationRef(String& t, String& coderef, int q) { Vector tl; @@ -75,7 +67,7 @@ bool AssistEditor::GetAnnotationRef(String& t, String& coderef, int q) int mi = 0; int m = 0; for(int i = 0; i < tl.GetCount(); i++) { - int mm = BestMatch(tl[i], path); + int mm = GetMatchLen(tl[i], path); if(mm > m) { mi = i; m = mm; diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index b58ae71be..6e5423fe8 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -50,10 +50,13 @@ AssistEditor::AssistEditor() searchindex <<= THISBACK(SearchIndex); navigatorpane.Add(indexpane.SizePos()); - scopepane.Add(browser.search_scope.HSizePos().TopPos(0, cy)); - scopepane.Add(browser.scope.HSizePos().VSizePos(cy + 2, 0)); + int c2 = cy + 2; + scopepane.Add(browser.search_scope.HSizePos(0, 4 * cy + 2).TopPos(0, cy)); + for(int i = 0; i < 4; i++) + scopepane.Add(browser.rangebutton[i].RightPos((3 - i) * cy, cy).TopPos(0, cy)); + scopepane.Add(browser.scope.HSizePos().VSizePos(c2, 0)); itempane.Add(browser.search_item.HSizePos().TopPos(0, cy)); - itempane.Add(browser.item.HSizePos().VSizePos(cy + 2, cy + 2)); + itempane.Add(browser.item.HSizePos().VSizePos(c2, c2)); itempane.Add(browser.search.HSizePos().BottomPos(0, cy)); scope_item.Vert(scopepane, itempane); scope_item.SetPos(3000); @@ -953,17 +956,30 @@ void Ide::JumpToDefinition(const Array& n, int q) { String qitem = n[q].qitem; int i = q; + int qml = 0; + int qcpp = -1; + int qcppml = 0; + int qimpl = -1; + int qimplml = 0; + String currentfile = editfile; while(i < n.GetCount() && n[i].qitem == qitem) { const CppItem& m = n[i]; - if(m.impl) { - GotoCpp(m); - return; + int ml = GetMatchLen(editfile, GetCppFile(m.file)); + if(m.impl && ml > qimplml) { + qimplml = ml; + qimpl = i; } - if(m.filetype == FILE_CPP || m.filetype == FILE_C) + if((m.filetype == FILE_CPP || m.filetype == FILE_C) && ml > qcppml) { + qcpp = i; + qcppml = ml; + } + if(ml > qml) { q = i; + qml = ml; + } i++; } - GotoCpp(n[q]); + GotoCpp(n[qimpl >= 0 ? qimpl : qcpp >= 0 ? qcpp : q]); } void Ide::IdeGotoCodeRef(String coderef) diff --git a/uppsrc/ide/Browser/Browser.h b/uppsrc/ide/Browser/Browser.h index e512b6b6c..eaf35397a 100644 --- a/uppsrc/ide/Browser/Browser.h +++ b/uppsrc/ide/Browser/Browser.h @@ -34,8 +34,11 @@ void ScanLayFile(const char *fn); String MakeCodeRef(const String& scope, const String& item); void SplitCodeRef(const String& ref, String& scope, String& item); +const CppItem *GetCodeRefItem(const String& ref, const String& rfile); const CppItem *GetCodeRefItem(const String& ref); +int GetMatchLen(const char *s, const char *t); + enum { WITHBODY = 33 }; inline Font BrowserFont() @@ -118,12 +121,15 @@ public: EditString search_item; EditString search; FrameRight