64,637
社区成员
发帖
与我相关
我的任务
分享
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp (revision 6195)
+++ src/sdk/cbeditor.cpp (working copy)
@@ -414,6 +414,23 @@
control->GotoPos(pos);
if (ch == _T('{'))
{
+ int curLine = control->GetCurrentLine();
+ int keyLine = curLine;
+ wxString text;
+ do
+ {
+ int keyPos = control->GetLineIndentPosition(keyLine);
+ int start = control->WordStartPosition(keyPos, true);
+ int end = control->WordEndPosition(keyPos, true);
+ text = control->GetTextRange(start, end);
+ }
+ while ((text.IsEmpty() || text == _T("public") || text == _T("protected") || text == _T("private"))
+ && text != _T("namespace")
+ && (--keyLine));
+
+ if (text == _T("class") || text == _T("struct") || text == _T("enum") || text == _T("union"))
+ control->InsertText(control->GetLineEndPosition(curLine), _T(";"));
+
const wxRegEx reg(_T("^[ \t]*{}[ \t]*"));
if (reg.Matches(control->GetCurLine()))
{
class A {|}
class B
{
|
}
struct A {|}
struct B
{
|
}
class A {|};
class B
{
|
};
struct A {|};
struct B
{
|
};
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 6195)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -2106,6 +2106,26 @@
}
}
}
+
+ if (event.GetEventType() == wxEVT_SCI_CHARADDED)
+ {
+ if (event.GetKey() == _T(':'))
+ {
+ if (control->AutoCompActive()) control->AutoCompCancel();
+ wxString text = control->GetCurLine().Trim(false);
+ text = text.Remove(text.Find(_T(':'), true));
+ text = text.Trim();
+ if (text == _T("public") || text == _T("protected") || text == _T("private"))
+ {
+ int curLine = control->GetCurrentLine();
+ control->GotoPos(control->GetLineIndentPosition(curLine));
+ control->BackTab();
+ control->GotoPos(control->GetLineEndPosition(curLine));
+ control->NewLine();
+ control->Tab();
+ }
+ }
+ }
Parser* parser = m_NativeParser.GetParserPtr();
if ( parser && parser->Options().whileTyping
class A
{
public:
void test()
{
int i = 0;
}
private:
int good()
{
}
protected:
};
class A
{
public:
void test()
{
int i = 0;
}
private:
int good()
{
}
protected:
};