Bugs item #1737639, was opened at 2007-06-15 10:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1737639&group_id=2439

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SciTE
Group: Bug
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: chupakabra (chupakabra)
Assigned to: Nobody/Anonymous (nobody)
Summary: Incorrect automatic indentation for C++

Initial Comment:
When automatic indentation is active and entering C++ constructs like
if (c) do();
editor automatically inserts indent on the next line of code. This indent is 
useful when writing constructs like:
if (c) {
  do();
}
or 
if (c)
  do();
but in this case it is not needed and has to be removed manually every time.

My way to fix it is to modify SciTEBase::GetIndentState(int). Here is the 
changed code fragment:
        // C like language indentation defined by braces and keywords
        IndentationStatus indentState = isNone;
        SString controlWords[20];
        unsigned int parts = GetLinePartsInStyle(line, 
statementIndent.styleNumber,
                -1, controlWords, ELEMENTS(controlWords));
        for (unsigned int i = 0; i < parts; i++) {
                if (includes(statementIndent, controlWords[i]))
                        indentState = isKeyWordStart;
        }
        parts = GetLinePartsInStyle(line, statementEnd.styleNumber,
                -1, controlWords, ELEMENTS(controlWords));
        for (unsigned int i = 0; i < parts; i++) {
                if (includes(statementEnd, controlWords[i]))
                        indentState = isNone;
        }

I don't know if this is a correct way to fix this problem but it seems to work 
for me. It is good to have it in original code though.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1737639&group_id=2439
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to