ide: Jump to definition improved #802

git-svn-id: svn://ultimatepp.org/upp/trunk@7525 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-07-21 17:17:32 +00:00
parent 0162bb2bde
commit f1a8b66d7d
4 changed files with 29 additions and 0 deletions

View file

@ -514,6 +514,8 @@ int CodeEditor::BlockReplace()
void CodeEditor::OpenNormalFindReplace0(bool replace)
{
if(GetLength() > 1000000)
findreplace.incremental <<= false;
findreplace.Setup(replace);
findreplace.find.SetFocus();
findreplace.itext = GetI();

View file

@ -1067,6 +1067,30 @@ bool IsPendif(const String& l)
return l.Find("#endif") >= 0;
}
void Ide::FindId(const String& id)
{
int pos = editor.GetCursor();
int h = min(editor.GetLength(), pos + 4000);
for(;;) {
if(pos >= h || findarg(editor[pos], ';', '{', '}') >= 0)
break;
if(iscib(editor[pos])) {
int p0 = pos;
String tid;
while(pos < h && iscid(editor[pos])) {
tid.Cat(editor[pos]);
pos++;
}
if(tid == id) {
editor.SetCursor(p0);
return;
}
}
else
pos++;
}
}
void Ide::ContextGoto0(int pos)
{
if(designer)
@ -1174,6 +1198,7 @@ void Ide::ContextGoto0(int pos)
if(q >= 0) {
AddHistory();
editor.SetCursor(editor.GetPos(parser.local[q].line - 1));
FindId(id);
return;
}
}
@ -1218,6 +1243,7 @@ void Ide::ContextGoto0(int pos)
for(int i = 0; i < n.GetCount(); i++) {
if(n[i].IsType() == istype && n[i].name == id) {
JumpToDefinition(n, i, scope[j]);
FindId(id);
return;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

View file

@ -984,6 +984,7 @@ public:
void ScanFile();
bool SwapSIf(const char *cref);
void SwapS();
void FindId(const String& id);
void ContextGoto0(int pos);
void ContextGoto();
void CtrlClick(int pos);