mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-06 17:46:07 +02:00
CodeTools: Fix incorrect auto-indent inside a "with"-block. Issue #19836, patch from Anton
git-svn-id: trunk@31881 -
This commit is contained in:
parent
8c93353490
commit
17251f4aa9
@ -139,6 +139,8 @@ type
|
|||||||
bbtWhileDo, // child of bbtWhile
|
bbtWhileDo, // child of bbtWhile
|
||||||
bbtFor,
|
bbtFor,
|
||||||
bbtForDo, // child of bbtFor
|
bbtForDo, // child of bbtFor
|
||||||
|
bbtWith,
|
||||||
|
bbtWithDo, // child of bbtWith
|
||||||
bbtCase,
|
bbtCase,
|
||||||
bbtCaseOf, // child of bbtCase
|
bbtCaseOf, // child of bbtCase
|
||||||
bbtCaseLabel, // child of bbtCaseOf
|
bbtCaseLabel, // child of bbtCaseOf
|
||||||
@ -165,7 +167,7 @@ const
|
|||||||
bbtAllCodeSections = [bbtInterface,bbtImplementation,bbtInitialization,
|
bbtAllCodeSections = [bbtInterface,bbtImplementation,bbtInitialization,
|
||||||
bbtFinalization];
|
bbtFinalization];
|
||||||
bbtAllStatementParents = [bbtMainBegin,bbtFreeBegin,bbtProcedureBegin,
|
bbtAllStatementParents = [bbtMainBegin,bbtFreeBegin,bbtProcedureBegin,
|
||||||
bbtRepeat,bbtWhileDo,bbtForDo,
|
bbtRepeat,bbtWhileDo,bbtForDo,bbtWithDo,
|
||||||
bbtCaseColon,bbtCaseElse,
|
bbtCaseColon,bbtCaseElse,
|
||||||
bbtTry,bbtFinally,bbtExcept,
|
bbtTry,bbtFinally,bbtExcept,
|
||||||
bbtIfThen,bbtIfElse,bbtIfBegin];
|
bbtIfThen,bbtIfElse,bbtIfBegin];
|
||||||
@ -174,7 +176,7 @@ const
|
|||||||
bbtAllBrackets = [bbtTypeRoundBracket,bbtTypeEdgedBracket,
|
bbtAllBrackets = [bbtTypeRoundBracket,bbtTypeEdgedBracket,
|
||||||
bbtStatementRoundBracket,bbtStatementEdgedBracket];
|
bbtStatementRoundBracket,bbtStatementEdgedBracket];
|
||||||
bbtAllAutoEnd = [bbtStatement,bbtIf,bbtIfThen,bbtIfElse,bbtWhile,bbtWhileDo,
|
bbtAllAutoEnd = [bbtStatement,bbtIf,bbtIfThen,bbtIfElse,bbtWhile,bbtWhileDo,
|
||||||
bbtFor,bbtForDo,bbtCaseLabel,bbtCaseColon];
|
bbtFor,bbtForDo,bbtWith,bbtWithDo,bbtCaseLabel,bbtCaseColon];
|
||||||
bbtAllAlignToSibling = [bbtNone]+bbtAllStatements;
|
bbtAllAlignToSibling = [bbtNone]+bbtAllStatements;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -214,6 +216,8 @@ const
|
|||||||
'bbtWhileDo',
|
'bbtWhileDo',
|
||||||
'bbtFor',
|
'bbtFor',
|
||||||
'bbtForDo',
|
'bbtForDo',
|
||||||
|
'bbtWith',
|
||||||
|
'bbtWithDo',
|
||||||
'bbtCase',
|
'bbtCase',
|
||||||
'bbtCaseOf',
|
'bbtCaseOf',
|
||||||
'bbtCaseLabel',
|
'bbtCaseLabel',
|
||||||
@ -874,6 +878,7 @@ begin
|
|||||||
case Stack.TopType of
|
case Stack.TopType of
|
||||||
bbtWhile: BeginBlock(bbtWhileDo);
|
bbtWhile: BeginBlock(bbtWhileDo);
|
||||||
bbtFor: BeginBlock(bbtForDo);
|
bbtFor: BeginBlock(bbtForDo);
|
||||||
|
bbtWith: BeginBlock(bbtWithDo);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
'E':
|
'E':
|
||||||
@ -1161,10 +1166,18 @@ begin
|
|||||||
StartIdentifierSection(bbtVarSection);
|
StartIdentifierSection(bbtVarSection);
|
||||||
end;
|
end;
|
||||||
'W':
|
'W':
|
||||||
|
case UpChars[r[1]] of
|
||||||
|
'H': // WH
|
||||||
if CompareIdentifiers('WHILE',r)=0 then begin
|
if CompareIdentifiers('WHILE',r)=0 then begin
|
||||||
if Stack.TopType in bbtAllStatements then
|
if Stack.TopType in bbtAllStatements then
|
||||||
BeginBlock(bbtWhile)
|
BeginBlock(bbtWhile)
|
||||||
end;
|
end;
|
||||||
|
'I': // WI
|
||||||
|
if CompareIdentifiers('WITH',r)=0 then begin
|
||||||
|
if Stack.TopType in bbtAllStatements then
|
||||||
|
BeginBlock(bbtWith)
|
||||||
|
end;
|
||||||
|
end;
|
||||||
';':
|
';':
|
||||||
begin
|
begin
|
||||||
// common syntax error: unclosed bracket => ignore it
|
// common syntax error: unclosed bracket => ignore it
|
||||||
|
Loading…
Reference in New Issue
Block a user