Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
Problem with tab in lines
daniloz:
Hi all,
I found I problem with the CodeCompletion plugin. It was not finding some symbols in my code. At first, it seemed random, but I could trace down the problem to lines that had a strange combination of spaces and tabs, after doing some debugging.
Here is an example code (. means space and > is the final position of a tab, my settings are tab=4 spaces)
--- Code: ---void main(void)
{
>int aabbaa;
>aabbaa
}
--- End code ---
(The code above has one tab before each declaration)
If you right click and say go to declaration, it works...
Now, replace the tab before aabbaa (equivalent to 4 spaces) with space+space+tab. The final code is:
--- Code: ---void main(void)
{
>int aabbaa;
.. >aabbaa
}
--- End code ---
With this code, if you right click on aabbaa and say go to declaration, is says "Not found".
This is because the tab is expanded in the nativeparser.cpp at line 2169
--- Code: ---actual_search.Replace(_T("\t"), tabwidth);
actual_search.Remove(col);
--- End code ---
, so each tab is replaced with 4 spaces, but the next line truncates the line based on the column position from screen, so 2 characters are left out. The reason is that the tab on editor is equivalent to 2 spaces only, keeping an indentation of 4.
I found a way to solve this by using the GetTextRange() function from wxscintilla...
--- Code: ---actual_search = searchData->control->GetTextRange(searchData->control->PositionFromLine(line), pos);
--- End code ---
A patch is attached against svn trunk r6857...
I'm using the patch in my systems and it seems to be working fine now.
killerbot:
this sounds like a very nice catch. I will try this myself later this weekd.
To other devs : please give it a try too ....
Jenna:
--- Quote from: killerbot on November 24, 2010, 03:06:28 pm ---this sounds like a very nice catch. I will try this myself later this weekd.
To other devs : please give it a try too ....
--- End quote ---
I did so and it seems to work.
I attach the same patch after removing some stuff, that was only needed by the old version.
daniloz:
--- Quote from: jens on November 24, 2010, 03:31:18 pm ---
--- Quote from: killerbot on November 24, 2010, 03:06:28 pm ---this sounds like a very nice catch. I will try this myself later this weekd.
To other devs : please give it a try too ....
--- End quote ---
I did so and it seems to work.
I attach the same patch after removing some stuff, that was only needed by the old version.
--- End quote ---
Thanks jens.. I've forget about it... :oops:
daniloz:
Hi again!
Should I submit a bug report with the patch to the BerliOs server? Or is the patch I've already submitted here being considering?
Navigation
[0] Message Index
[#] Next page
Go to full version