mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 17:20: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>
|
||||
// end;
|
||||
var
|
||||
List: TStrings;
|
||||
List, Params: TStrings;
|
||||
Code: TCodeBuffer;
|
||||
CaretXY: TPoint;
|
||||
p: integer;
|
||||
i: Integer;
|
||||
Indent : String;
|
||||
Indent, Param: String;
|
||||
WithoutExtraIndent: Boolean;
|
||||
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;
|
||||
try
|
||||
CaretXY:=SrcEdit.CursorTextXY;
|
||||
@ -522,6 +544,15 @@ begin
|
||||
end;
|
||||
|
||||
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:='';
|
||||
for i:=0 to List.Count-1 do
|
||||
Value:=Value+ Indent + List[i]+': ;'+LineEnding;
|
||||
|
@ -5608,7 +5608,11 @@ resourcestring
|
||||
+'token in source is an end and if not returns lineend + end; + lineend';
|
||||
lisListOfAllCaseValues = 'list of all case values';
|
||||
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';
|
||||
lisTemplateEditParamCell = 'Editable Cell';
|
||||
lisTemplateEditParamCellHelp =
|
||||
|
Loading…
Reference in New Issue
Block a user