Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
hook "tab" key
Loaden:
I solved this problem.
--- Code: ---cbStyledTextCtrl* cbEditor::CreateEditor()
{
m_ID = wxNewId();
// avoid gtk-critical because of sizes less than -1 (can happen with wxAuiNotebook/cbAuiNotebook)
wxSize size = m_pControl ? wxDefaultSize : GetSize();
size.x = std::max(size.x, -1);
size.y = std::max(size.y, -1);
cbStyledTextCtrl* control = new cbStyledTextCtrl(this, m_ID, wxDefaultPosition, size);
control->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(cbEditor::OnKeyDown));
--- End code ---
Notice:
control->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(cbEditor::OnKeyDown));
Loaden:
I make a patch for this, welcome to test.
[attachment deleted by admin]
ollydbg:
--- Quote from: Loaden on March 25, 2010, 05:18:13 pm ---I make a patch for this, welcome to test.
--- End quote ---
I found a bug:
When I enter this:
--- Code: ---void f(
--- End code ---
Then, I will get the close parenthesis auto added.
--- Code: ---void f(|)
--- End code ---
But at this moment, I press backspace key, then the opening parenthesis was deleted but the close parenthesis still there.
--- Code: ---void f)
--- End code ---
Except this bug, all the other functions works really nice!!! Thanks for the contribution.
Loaden:
--- Quote from: ollydbg on March 26, 2010, 01:59:31 am ---
--- Quote from: Loaden on March 25, 2010, 05:18:13 pm ---I make a patch for this, welcome to test.
--- End quote ---
I found a bug:
When I enter this:
--- Code: ---void f(
--- End code ---
Then, I will get the close parenthesis auto added.
--- Code: ---void f(|)
--- End code ---
But at this moment, I press backspace key, then the opening parenthesis was deleted but the close parenthesis still there.
--- Code: ---void f)
--- End code ---
Except this bug, all the other functions works really nice!!! Thanks for the contribution.
--- End quote ---
Fix now.
[attachment deleted by admin]
MortenMacFly:
--- Quote from: Loaden on March 26, 2010, 04:29:42 am ---Fix now.
--- End quote ---
Some remarks concerning this patch:
1.) Methods should not start like "No", "Dont", "Not". This is hard to read. Instead always call a method like e.g. "AllowTabSmartJump" and change the break statement to "if (!AllowTabSmartJump()) break;"
2.) The trial for AllowTabSmartJump() should be the first statement in the method, like:
--- Code: ---if (!AllowTabSmartJump())
{
event.Skip();
return;
}
--- End code ---
3.) These statements look weird to me:
--- Code: --- case _T('\''):
case 57: // (
case 0x91: // {
--- End code ---
You are using character comparison, then integer and finally hex. Why? Couldn't this be consistent, readable like e.g. all of type char?
4.) It does not use our code style (indention of 4 spaces)
...if you keep that in mind then it easier for us to integrate with the C::B sources.
...sorry for nut-picking. Take it as a hint for future work.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version