mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-13 10:29:24 +02:00
IDE: new file: do not break lines at dots
git-svn-id: branches/fixes_2_0@63407 -
This commit is contained in:
parent
eed62ab14b
commit
27188db548
@ -270,6 +270,11 @@ type
|
||||
var AText: String; var AMode: TSemSelectionMode; ALogStartPos: TPoint;
|
||||
var AnAction: TSemCopyPasteAction) of object;
|
||||
|
||||
TSemBeautyFlag = (
|
||||
sembfNotBreakDots
|
||||
);
|
||||
TSemBeautyFlags = set of TSemBeautyFlag;
|
||||
|
||||
{ TSourceEditorManagerInterface }
|
||||
|
||||
TSourceEditorManagerInterface = class(TComponent)
|
||||
@ -319,7 +324,7 @@ type
|
||||
// Messages
|
||||
procedure ClearErrorLines; virtual; abstract;
|
||||
// General source functions
|
||||
function Beautify(const Src: string): string; virtual; abstract;
|
||||
function Beautify(const Src: string; const Flags: TSemBeautyFlags = []): string; virtual; abstract;
|
||||
protected
|
||||
// Completion Plugins
|
||||
function GetActiveCompletionPlugin: TSourceEditorCompletionPlugin; virtual; abstract;
|
||||
|
@ -1109,7 +1109,7 @@ type
|
||||
procedure ClearExecutionMarks;
|
||||
procedure FillExecutionMarks;
|
||||
procedure ReloadEditorOptions;
|
||||
function Beautify(const Src: string): string; override;
|
||||
function Beautify(const Src: string; const Flags: TSemBeautyFlags = []): string; override;
|
||||
// find / replace text
|
||||
procedure FindClicked(Sender: TObject);
|
||||
procedure FindNextClicked(Sender: TObject);
|
||||
@ -10286,20 +10286,36 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSourceEditorManager.Beautify(const Src: string): string;
|
||||
function TSourceEditorManager.Beautify(const Src: string;
|
||||
const Flags: TSemBeautyFlags): string;
|
||||
var
|
||||
NewIndent, NewTabWidth: Integer;
|
||||
Beauty: TBeautifyCodeOptions;
|
||||
OldDoNotSplitLineInFront, OldDoNotSplitLineAfter: TAtomTypes;
|
||||
begin
|
||||
Result:=CodeToolBoss.Beautifier.BeautifyStatement(Src,2,[bcfDoNotIndentFirstLine]);
|
||||
Beauty:=CodeToolBoss.SourceChangeCache.BeautifyCodeOptions;
|
||||
OldDoNotSplitLineInFront:=Beauty.DoNotSplitLineInFront;
|
||||
OldDoNotSplitLineAfter:=Beauty.DoNotSplitLineAfter;
|
||||
try
|
||||
if sembfNotBreakDots in Flags then
|
||||
begin
|
||||
Include(Beauty.DoNotSplitLineInFront,atPoint);
|
||||
Include(Beauty.DoNotSplitLineAfter,atPoint);
|
||||
end;
|
||||
Result:=CodeToolBoss.Beautifier.BeautifyStatement(Src,2,[bcfDoNotIndentFirstLine]);
|
||||
|
||||
if (eoTabsToSpaces in EditorOpts.SynEditOptions)
|
||||
or (EditorOpts.BlockTabIndent=0) then
|
||||
NewTabWidth:=0
|
||||
else
|
||||
NewTabWidth:=EditorOpts.TabWidth;
|
||||
NewIndent:=EditorOpts.BlockTabIndent*EditorOpts.TabWidth+EditorOpts.BlockIndent;
|
||||
if (eoTabsToSpaces in EditorOpts.SynEditOptions)
|
||||
or (EditorOpts.BlockTabIndent=0) then
|
||||
NewTabWidth:=0
|
||||
else
|
||||
NewTabWidth:=EditorOpts.TabWidth;
|
||||
NewIndent:=EditorOpts.BlockTabIndent*EditorOpts.TabWidth+EditorOpts.BlockIndent;
|
||||
|
||||
Result:=BasicCodeTools.ReIndent(Result,2,0,NewIndent,NewTabWidth);
|
||||
Result:=BasicCodeTools.ReIndent(Result,2,0,NewIndent,NewTabWidth);
|
||||
finally
|
||||
Beauty.DoNotSplitLineInFront:=OldDoNotSplitLineInFront;
|
||||
Beauty.DoNotSplitLineAfter:=OldDoNotSplitLineAfter;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.FindClicked(Sender: TObject);
|
||||
|
Loading…
Reference in New Issue
Block a user