theide: Include assist now supports ..

git-svn-id: svn://ultimatepp.org/upp/trunk@3388 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-04-29 12:43:04 +00:00
parent 9821f36998
commit dfc907b3b1
2 changed files with 13 additions and 9 deletions

View file

@ -352,6 +352,12 @@ bool AssistEditor::IncludeAssist()
include_local = false;
}
include_path.Clear();
include_back = 0;
if(include_local)
while(p.Char3('.', '.', '/') || p.Char3('.', '.', '\\')) {
include.Top() = GetFileFolder(include.Top());
include_back++;
}
for(;;) {
String dir;
while(isincludefnchar(p.PeekChar()))
@ -594,9 +600,12 @@ void AssistEditor::AssistInsert()
int pos = GetPos(ln);
Remove(pos, GetLineLength(ln));
SetCursor(pos);
String h;
for(int i = 0; i < include_back; i++)
h << "../";
Paste(ToUnicode(String().Cat() << "#include "
<< (include_local ? "\"" : "<")
<< include_path
<< h << include_path
<< f.name
<< (f.kind == KIND_INCLUDEFOLDER ? "/" :
include_local ? "\"" : ">")
@ -747,14 +756,8 @@ bool AssistEditor::Key(dword key, int count)
Assist();
}
}
if(key == '\"' || key == '<') {
int q = GetCursor() - 2;
if(q > 0) {
String id = IdBack(q);
if(id == "include" && Ch(q - 1) == '#')
Assist();
}
}
if((key == '\"' || key == '<' || key == '/' || key == '\\') && GetUtf8Line(GetCursorLine()).StartsWith("#include"))
Assist();
}
return b;
}

View file

@ -336,6 +336,7 @@ struct AssistEditor : CodeEditor {
int cachedpos;
int cachedln;
bool include_local;
int include_back;
String include_path;
RichTextCtrl param_info;