mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 18:01:29 +02:00
IDE, CodeTools: new "WithoutExtraIndent" parameter in "case ofall" code template. When used the case-list will be flat (prior behavior). When not used, case-list will be indented with default editor options.
git-svn-id: trunk@53040 -
This commit is contained in:
parent
c0cc369d3d
commit
ec17f5b9c0
@ -488,13 +488,35 @@ function CodeMacroOfAll(const Parameter: string; InteractiveValue: TPersistent;
|
|||||||
// <list of enums>
|
// <list of enums>
|
||||||
// end;
|
// end;
|
||||||
var
|
var
|
||||||
List: TStrings;
|
List, Params: TStrings;
|
||||||
Code: TCodeBuffer;
|
Code: TCodeBuffer;
|
||||||
CaretXY: TPoint;
|
CaretXY: TPoint;
|
||||||
p: integer;
|
p: integer;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
Indent : String;
|
Indent, Param: String;
|
||||||
|
WithoutExtraIndent: Boolean;
|
||||||
begin
|
begin
|
||||||
|
WithoutExtraIndent := False;
|
||||||
|
Params:=SplitString(Parameter,',');
|
||||||
|
if Params<>nil then
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
for i:=0 to Params.Count-1 do
|
||||||
|
begin
|
||||||
|
Param:=Params[i];
|
||||||
|
if SysUtils.CompareText(Param,'WithoutExtraIndent')=0 then
|
||||||
|
WithoutExtraIndent := True
|
||||||
|
else begin
|
||||||
|
Result:=false;
|
||||||
|
ErrorMsg:='Unknown Option: "'+Param+'"';
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
Params.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
List:=TStringList.Create;
|
List:=TStringList.Create;
|
||||||
try
|
try
|
||||||
CaretXY:=SrcEdit.CursorTextXY;
|
CaretXY:=SrcEdit.CursorTextXY;
|
||||||
@ -522,6 +544,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Indent := StringOfChar(' ',CodeToolBoss.IndentSize);
|
Indent := StringOfChar(' ',CodeToolBoss.IndentSize);
|
||||||
|
|
||||||
|
if not WithoutExtraIndent then
|
||||||
|
begin
|
||||||
|
if eoTabsToSpaces in EditorOptions.EditorOpts.SynEditOptions then
|
||||||
|
Indent := Indent+StringOfChar(' ',EditorOptions.EditorOpts.TabWidth)
|
||||||
|
else
|
||||||
|
Indent := Indent+#9;
|
||||||
|
end;
|
||||||
|
|
||||||
Value:='';
|
Value:='';
|
||||||
for i:=0 to List.Count-1 do
|
for i:=0 to List.Count-1 do
|
||||||
Value:=Value+ Indent + List[i]+': ;'+LineEnding;
|
Value:=Value+ Indent + List[i]+': ;'+LineEnding;
|
||||||
|
@ -5608,7 +5608,11 @@ resourcestring
|
|||||||
+'token in source is an end and if not returns lineend + end; + lineend';
|
+'token in source is an end and if not returns lineend + end; + lineend';
|
||||||
lisListOfAllCaseValues = 'list of all case values';
|
lisListOfAllCaseValues = 'list of all case values';
|
||||||
lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria = 'returns list of '
|
lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria = 'returns list of '
|
||||||
+'all values of case variable in front of variable';
|
+'all values of case variable in front of variable'#13
|
||||||
|
+#13
|
||||||
|
+'Optional Parameters (comma separated):'#13
|
||||||
|
+'WithoutExtraIndent // the case list will be generated without extra indentation';
|
||||||
|
|
||||||
lisGetWordAtCurrentCursorPosition = 'get word at current cursor position';
|
lisGetWordAtCurrentCursorPosition = 'get word at current cursor position';
|
||||||
lisTemplateEditParamCell = 'Editable Cell';
|
lisTemplateEditParamCell = 'Editable Cell';
|
||||||
lisTemplateEditParamCellHelp =
|
lisTemplateEditParamCellHelp =
|
||||||
|
Loading…
Reference in New Issue
Block a user