Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
cbeditor's bug fix in bracecompletion function
Loaden:
--- Code: ---Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp (revision 6196)
+++ src/sdk/cbeditor.cpp (working copy)
@@ -404,10 +404,11 @@
const wxString rightBrace(_T(")]}"));
int index = leftBrace.Find(ch);
const wxString unWant(_T(");\n\r\t\b "));
+ wxChar nextChar = control->GetCharAt(pos);
#if wxCHECK_VERSION(2, 9, 0)
- if ((index != wxNOT_FOUND) && (unWant.Find(wxUniChar(control->GetCharAt(pos))) != wxNOT_FOUND))
+ if ((index != wxNOT_FOUND) && (unWant.Find(wxUniChar(nextChar)) != wxNOT_FOUND) || nextChar == _T('\0'))
#else
- if ((index != wxNOT_FOUND) && (unWant.Find(control->GetCharAt(pos)) != wxNOT_FOUND))
+ if ((index != wxNOT_FOUND) && (unWant.Find(nextChar) != wxNOT_FOUND) || nextChar == _T('\0'))
#endif
{
control->AddText(rightBrace.GetChar(index));
--- End code ---
Bug reproduce:
1. Create project, open the main.cpp, and delete ALL the characters. (Ctrl + A, Delete)
2. Pressing '(', will find no match.
[attachment deleted by admin]
killerbot:
this can also happen when you open an existing file.
Got to the end of the file and type
1)
{
or
2)
if(
Also here the closing brace doesn't show up.I will try your modification. Would be great this is solved.
Loaden:
--- Quote from: killerbot on March 25, 2010, 10:29:26 am ---this can also happen when you open an existing file.
Got to the end of the file and type
1)
{
or
2)
if(
Also here the closing brace doesn't show up.I will try your modification. Would be great this is solved.
--- End quote ---
Yes, This patch can fix it also.
killerbot:
I can confirm that my first case is fixed.
But I see something strange happening in the seconds (unless my laptop/linux is pulling my leg).
When I type somewhere in my existing file
--- Code: ---if
--- End code ---
The this works ok.
But when at type this at the end of my file (which has an empty line at the end (as required by the standard), the moment I have typed the
--- Code: ---i
--- End code ---
I get something strange :
--- Code: ---iDC3
--- End code ---
and that DC3 is white characters on a black background.
I will reboot later on, and see if this remains.
EDIT : yes it does, so seems there is a side effect.
Loaden:
--- Quote from: killerbot on March 25, 2010, 12:10:38 pm ---I can confirm that my first case is fixed.
But I see something strange happening in the seconds (unless my laptop/linux is pulling my leg).
When I type somewhere in my existing file
--- Code: ---if
--- End code ---
The this works ok.
But when at type this at the end of my file (which has an empty line at the end (as required by the standard), the moment I have typed the
--- Code: ---i
--- End code ---
I get something strange :
--- Code: ---iDC3
--- End code ---
and that DC3 is white characters on a black background.
I will reboot later on, and see if this remains.
EDIT : yes it does, so seems there is a side effect.
--- End quote ---
Maybe I did not understand the specific steps, I can not reproduce this problem.
When I type 'i', will still work well.
I can not see 'DC3' value, even though I selected the "Show end-of-line chars" option. :x
My OS is WinXPSP3, and wxWidgets is 2.8.10.
Navigation
[0] Message Index
[#] Next page
Go to full version