Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
Some strange behaviors
blueshake:
That is right.I download the svn 5716 Nightly builds.and it still exist ,it is strange .
see the attachment .
[attachment deleted by admin]
ollydbg:
That's strange. My local copy was using "trunk + cc_branch + my own patch" , so...
blueshake:
--- Quote ---Currently i found some strange behaviors using the new CC Branch of Code::Blocks:
1) if i enter
Code:
while ()
and then press "." it will be autocompleted as
Code:
while ().while
--- End quote ---
this problem can be solved by this patch.
--- Code: ---Index: nativeparser.cpp
===================================================================
--- nativeparser.cpp (revision 5744)
+++ nativeparser.cpp (working copy)
@@ -1214,8 +1214,8 @@
case '(': --nest; break;
}
}
- if ((x > 0) && (wxIsalnum(line.GetChar(x - 1)) || line.GetChar(x - 1) == '_'))
- --x;
+ //if ((x > 0) && (wxIsalnum(line.GetChar(x - 1)) || line.GetChar(x - 1) == '_'))
+ // --x;
}
}
}
--- End code ---
ollydbg:
Can you explain a little about this modify on the function:
--- Code: ---unsigned int NativeParser::FindCCTokenStart(const wxString& line)
{
......
return x;
}
--- End code ---
Thanks!
ollydbg:
The function is list below:
--- Code: ---unsigned int NativeParser::FindCCTokenStart(const wxString& line)
{
int x = line.Length() - 1;
int nest = 0;
bool repeat = true;
while (repeat)
{
repeat = false;
while ((x >= 0) && (wxIsalnum(line.GetChar(x)) || line.GetChar(x) == '_'))
--x;
if ( (x > 0) &&
( (line.GetChar(x) == '>' && line.GetChar(x - 1) == '-') ||
(line.GetChar(x) == ':' && line.GetChar(x - 1) == ':') ) )
{
x -= 2;
repeat = true;
}
else if ((x >= 0) && (line.GetChar(x) == '.'))
{
--x;
repeat = true;
}
if (repeat)
{
// now we 're just before the "." or "->" or "::"
// skip any whitespace
while ((x >= 0) && (line.GetChar(x) == ' ' || line.GetChar(x) == '\t'))
--x;
// check for function/array/cast ()
if ((x >= 0) && (line.GetChar(x) == ')' || line.GetChar(x) == ']'))
{
++nest;
while (--x >= 0 && nest != 0)
{
#if wxCHECK_VERSION(2, 9, 0)
switch (line.GetChar(x).GetValue())
#else
switch (line.GetChar(x))
#endif
{
case ']':
case ')': ++nest; break;
case '[':
case '(': --nest; break;
}
}
if ((x > 0) && (wxIsalnum(line.GetChar(x - 1)) || line.GetChar(x - 1) == '_'))
--x;
}
}
}
++x;
if (x < 0)
x = 0;
while (line.GetChar(x) == ' ' || line.GetChar(x) == '\t')
++x;
//Manager::Get()->GetLogManager()->DebugLog("Starting at %d \"%s\"", x, line.Mid(x).c_str());
return x;
}
--- End code ---
I think we need to "skip any whitespace" after we find the "[" in the following line
--- Code: ---while ().
--- End code ---
That is what I think is right :D:
--- Code: --- while (--x >= 0 && nest != 0)
{
#if wxCHECK_VERSION(2, 9, 0)
switch (line.GetChar(x).GetValue())
#else
switch (line.GetChar(x))
#endif
{
case ']':
case ')': ++nest; break;
case '[':
case '(': --nest; break;
}
}
//***************ADD code here:
// skip any whitespace
while ((x >= 0) && (line.GetChar(x) == ' ' || line.GetChar(x) == '\t'))
--x;
//**************
......
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version