ide: Virtuals and Goto now match search string partially (#114, thanks SenderGhost)

git-svn-id: svn://ultimatepp.org/upp/trunk@4119 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-11-04 10:06:48 +00:00
parent 085ddd77c3
commit cc161fab24
3 changed files with 23 additions and 13 deletions

View file

@ -23,7 +23,7 @@ struct GotoDlg : public WithGotoLayout<TopWindow> {
void GotoDlg::SyncList()
{
list.Clear();
String n = ~target;
String n = ToLower((String)~target);
int typei = Null;
String scope = Null;
Vector<String> h = Split(n, ':');
@ -51,6 +51,14 @@ void GotoDlg::SyncList()
if(IsDigit(*n))
n.Clear();
Index<String> nc;
for(int i = 0; i < item.GetCount(); i++) {
const CppItemInfo& f = item[i];
if(ToLower(f.name).Find(n) >= 0 && (IsNull(typei) || typei == f.typei) && (IsNull(scope) || scope == f.scope)) {
list.Add(f.scope, RawToValue(f), f.item, f.line, GetCppFile(f.file), f.scope);
nc.FindAdd(f.scope);
}
}
/*
for(int ci = 0; ci < (n.GetCount() ? 2 : 1); ci++)
for(int i = 0; i < item.GetCount(); i++) {
const CppItemInfo& f = item[i];
@ -63,6 +71,7 @@ void GotoDlg::SyncList()
nc.FindAdd(f.scope);
}
}
*/
list.HeaderTab(0).SetText(Format("Scope (%d)", nc.GetCount()));
list.HeaderTab(1).SetText(Format("Symbol (%d)", list.GetCount()));
SyncOk();
@ -89,7 +98,7 @@ void GotoDlg::SyncOk()
int GotoFilter(int c)
{
return IsDigit(c) || IsAlpha(c) || c == '_' || c == ':' ? c : c == '.' ? ':' : 0;
return IsDigit(c) || IsAlpha(c) || c == '_' || c == ':' ? ToUpper(c) : c == '.' ? ':' : 0;
}
void GotoDlg::Serialize(Stream& s)

View file

@ -57,18 +57,18 @@ struct VirtualsDlg : public WithVirtualsLayout<TopWindow> {
}
void Sync() {
String name = ~find;
String name = ToLower((String)~find);
String k = list.GetKey();
list.Clear();
for(int i = 0; i < item.GetCount(); i++) {
CppItemInfo f;
(CppItem&)f = item[i];
f.virt = false;
f.name = item[i].name;
if(memcmp_i(name, f.name, name.GetCount()) == 0)
for(int i = 0; i < item.GetCount(); i++)
if(ToLower(item[i].name).Find(name) >= 0) {
CppItemInfo f;
(CppItem&)f = item[i];
f.virt = false;
f.name = item[i].name;
list.Add(item.GetKey(i), f.natural, RawToValue(f),
item[i].defined, item[i].overed);
}
item[i].defined, item[i].overed);
}
if(!list.FindSetCursor(k))
list.GoBegin();
}
@ -103,6 +103,7 @@ struct VirtualsDlg : public WithVirtualsLayout<TopWindow> {
list.MultiSelect();
list.EvenRowColor();
Sizeable().Zoomable();
find.SetFilter(SearchItemFilter);
find <<= THISBACK(Sync);
Sync();
}

View file

@ -527,8 +527,8 @@ LAYOUT(VirtualsLayout, 712, 496)
ITEM(ArrayCtrl, list, HSizePosZ(8, 8).VSizePosZ(8, 40))
ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(80, 64).BottomPosZ(8, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(12, 64).BottomPosZ(8, 24))
ITEM(Label, dv___3, SetLabel(t_("Find")).LeftPosZ(8, 28).BottomPosZ(9, 19))
ITEM(EditString, find, LeftPosZ(36, 124).BottomPosZ(9, 19))
ITEM(Label, dv___3, SetLabel(t_("Find")).LeftPosZ(8, 60).BottomPosZ(9, 19))
ITEM(EditString, find, LeftPosZ(72, 124).BottomPosZ(9, 19))
END_LAYOUT
LAYOUT(UppOptDlg, 520, 68)