Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Patch, Auto add a semicolon for '{}' auto-complete

<< < (3/4) > >>

Loaden:

--- Quote from: MortenMacFly on March 24, 2010, 04:27:49 pm ---
--- Quote from: ollydbg on March 24, 2010, 04:24:40 pm ---Loaden use this for condition below:

--- Code: ---while (text.IsEmpty() && --keyLine);
--- End code ---
Look at the variable: keyLine, when it reaches zero, the loop will break, so, there will never be a infinite loop.

--- End quote ---
Indeed. I missed that. C++ style calculations inside an if/while statement - I don't allow such in my coding style, so I am not used to it.

--- End quote ---

Please test this demo:



--- Code: ---class A



{
--- End code ---
If not use "do/while", when type '{', it can not judge the class type. :(

MortenMacFly:

--- Quote from: Loaden on March 24, 2010, 04:40:28 pm ---Please test this demo:

--- Code: ---class A



{
--- End code ---
If not use "do/while", when type '{', it can not judge the class type. :(

--- End quote ---
??? Strange. I did not apply in my copy yet, but what if you use:

--- Code: ---                do
                {
                    int keyPos = control->GetLineIndentPosition(keyLine);
                    int start = control->WordStartPosition(keyPos, true);
                    int end = control->WordEndPosition(keyPos, true);
                    text = control->GetTextRange(start, end)
                    text.Trim();
                    --keyLine;
                }
                while ( text.IsEmpty() && (keyLine>0) );

--- End code ---
Notice: This is untested.

ollydbg:
But noone will write this kind of code, search to the previous line is enough.

Loaden:

--- Quote from: MortenMacFly on March 24, 2010, 04:43:29 pm ---??? Strange. I did not apply in my copy yet, but what if you use:

--- Code: ---                do
                {
                    int keyPos = control->GetLineIndentPosition(keyLine);
                    int start = control->WordStartPosition(keyPos, true);
                    int end = control->WordEndPosition(keyPos, true);
                    text = control->GetTextRange(start, end)
                    text.Trim();
                    --keyLine;
                }
                while ( text.IsEmpty() && (keyLine>0) );

--- End code ---
Notice: This is untested.

--- End quote ---
I test it, but it's not work for 'namespace {' question.
I will check it, and fix this problem.

oBFusCATed:

--- Quote from: ollydbg on March 24, 2010, 04:46:38 pm ---But noone will write this kind of code, search to the previous line is enough.

--- End quote ---


--- Code: ---
class A :
       public B1,
       public B2,
       public B3,
       public B4
{
     |
};

--- End code ---

Replace A, B1-4 with very long strings and for sure someone will write such code :)


--- Code: ---namespace my
{
}; <--- here the semicolon is not needed!

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version