mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
A++ - param info tip improved to support nested assists, Esc closes the tip
git-svn-id: svn://ultimatepp.org/upp/trunk@665 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
803866298a
commit
29ac096dcc
4 changed files with 69 additions and 36 deletions
|
|
@ -86,7 +86,7 @@ AssistEditor::AssistEditor()
|
|||
cachedpos = INT_MAX;
|
||||
cachedln = -1;
|
||||
|
||||
param_line = -1;
|
||||
parami = 0;
|
||||
|
||||
param_info.Margins(2);
|
||||
param_info.Background(SWhite());
|
||||
|
|
@ -460,7 +460,6 @@ void AssistEditor::AssistInsert()
|
|||
{
|
||||
if(assist.IsCursor()) {
|
||||
const CppItemInfo& f = ValueTo<CppItemInfo>(assist.Get(0));
|
||||
param_item = f;
|
||||
String txt = f.name;
|
||||
int l = txt.GetCount();
|
||||
int pl = txt.GetCount();
|
||||
|
|
@ -489,7 +488,7 @@ void AssistEditor::AssistInsert()
|
|||
int n = Paste(ToUnicode(txt, CHARSET_WIN1250));
|
||||
if(!thisback && f.kind >= FUNCTION && f.kind <= INLINEFRIEND) {
|
||||
SetCursor(GetCursor() - 1);
|
||||
StartParamInfo();
|
||||
StartParamInfo(f);
|
||||
if(f.qptype.GetCount() == 0)
|
||||
SetCursor(GetCursor() + 1);
|
||||
}
|
||||
|
|
@ -996,3 +995,20 @@ void Ide::IdeGotoCodeRef(String coderef)
|
|||
if(q >= 0)
|
||||
JumpToDefinition(n, q);
|
||||
}
|
||||
|
||||
bool AssistEditor::Esc()
|
||||
{
|
||||
bool r = false;
|
||||
if(assist.IsOpen()) {
|
||||
CloseAssist();
|
||||
r = true;
|
||||
}
|
||||
if(param_info.IsOpen()) {
|
||||
for(int i = 0; i < PARAMN; i++)
|
||||
param[i].line = -1;
|
||||
param_info.Close();
|
||||
r = true;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,10 +197,8 @@ bool Ide::IsBottomShown() const
|
|||
|
||||
void Ide::SwapBottom()
|
||||
{
|
||||
if(editor.assist.IsOpen()) {
|
||||
editor.CloseAssist();
|
||||
if(editor.Esc())
|
||||
return;
|
||||
}
|
||||
if(editor.IsFindOpen())
|
||||
editor.FindClose();
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,18 +3,24 @@
|
|||
void AssistEditor::SyncParamInfo()
|
||||
{
|
||||
String qtf;
|
||||
int mpar = INT_MAX;
|
||||
for(int q = 0; q < PARAMN; q++) {
|
||||
ParamInfo& m = param[q];
|
||||
int i = GetCursorLine();
|
||||
if(param_line >= 0 && param_line < GetLineCount() && i >= param_line && i < param_line + 10
|
||||
&& param_editfile == theide->editfile && GetWLine(param_line).StartsWith(param_test)) {
|
||||
if(m.line >= 0 && m.line < GetLineCount() && i >= m.line && i < m.line + 10
|
||||
&& m.editfile == theide->editfile && GetWLine(m.line).StartsWith(m.test)) {
|
||||
int c = GetCursor();
|
||||
i = GetPos(param_line) + param_test.GetCount();
|
||||
i = GetPos(m.line) + m.test.GetCount();
|
||||
if(c >= i) {
|
||||
int par = 0;
|
||||
int pari = 0;
|
||||
for(;;) {
|
||||
int ch = Ch(i++);
|
||||
if(i > c) {
|
||||
qtf = "[A1 " + DecoratedItem(param_item.name, param_item, param_item.natural, pari);
|
||||
if(par < mpar) {
|
||||
qtf = "[A1 " + DecoratedItem(m.item.name, m.item, m.item.natural, pari);
|
||||
mpar = par;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(ch == ')') {
|
||||
|
|
@ -29,6 +35,7 @@ void AssistEditor::SyncParamInfo()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(param_qtf != qtf)
|
||||
param_info.SetQTF(qtf);
|
||||
Rect r = GetLineScreenRect(GetCursorLine());
|
||||
|
|
@ -53,11 +60,14 @@ void AssistEditor::SyncParamInfo()
|
|||
}
|
||||
}
|
||||
|
||||
void AssistEditor::StartParamInfo()
|
||||
void AssistEditor::StartParamInfo(const CppItem& m)
|
||||
{
|
||||
int x = GetCursor();
|
||||
param_line = GetLinePos(x);
|
||||
param_test = GetWLine(param_line).Mid(0, x);
|
||||
param_editfile = theide->editfile;
|
||||
ParamInfo& f = param[parami];
|
||||
f.line = GetLinePos(x);
|
||||
f.test = GetWLine(f.line).Mid(0, x);
|
||||
f.item = m;
|
||||
f.editfile = theide->editfile;
|
||||
SyncParamInfo();
|
||||
parami = (parami + 1) % PARAMN;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,11 +407,18 @@ struct AssistEditor : CodeEditor {
|
|||
int cachedln;
|
||||
|
||||
RichTextCtrl param_info;
|
||||
int param_line;
|
||||
WString param_test;
|
||||
CppItem param_item;
|
||||
String param_qtf;
|
||||
String param_editfile;
|
||||
struct ParamInfo {
|
||||
int line;
|
||||
WString test;
|
||||
CppItem item;
|
||||
String editfile;
|
||||
|
||||
ParamInfo() { line = -1; }
|
||||
};
|
||||
enum { PARAMN = 16 };
|
||||
ParamInfo param[PARAMN];
|
||||
int parami;
|
||||
|
||||
void PopUpAssist(bool auto_insert = false);
|
||||
void CloseAssist();
|
||||
|
|
@ -422,7 +429,7 @@ struct AssistEditor : CodeEditor {
|
|||
bool InCode();
|
||||
|
||||
void SyncParamInfo();
|
||||
void StartParamInfo();
|
||||
void StartParamInfo(const CppItem& m);
|
||||
|
||||
void Complete();
|
||||
|
||||
|
|
@ -482,6 +489,8 @@ struct AssistEditor : CodeEditor {
|
|||
void OpenTopic(String topic, String create, bool before);
|
||||
void NewTopic(String group, String coderef);
|
||||
|
||||
bool Esc();
|
||||
|
||||
void SerializeNavigator(Stream& s);
|
||||
|
||||
typedef AssistEditor CLASSNAME;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue