You've already forked lazarus-ccr
LazEdit: open file in unused open current editor if available, else in newly created editor
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2476 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -99,6 +99,7 @@ type
|
|||||||
procedure LoadFromFileUtf8(const Utf8Fn: String; const AsTemplate: Boolean = False);
|
procedure LoadFromFileUtf8(const Utf8Fn: String; const AsTemplate: Boolean = False);
|
||||||
procedure SaveToFileAnsi(const AnsiFn: String);
|
procedure SaveToFileAnsi(const AnsiFn: String);
|
||||||
procedure SaveToFileUtf8(const Utf8Fn: String);
|
procedure SaveToFileUtf8(const Utf8Fn: String);
|
||||||
|
function IsUnused: Boolean;
|
||||||
procedure SetHighlighterByFileType(const AFileType: TEditorFileType; const Permanent: Boolean = False);
|
procedure SetHighlighterByFileType(const AFileType: TEditorFileType; const Permanent: Boolean = False);
|
||||||
procedure MarkSelection(const Pre, Post: String);
|
procedure MarkSelection(const Pre, Post: String);
|
||||||
|
|
||||||
@ -690,6 +691,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TEditor.IsUnused: Boolean;
|
||||||
|
begin
|
||||||
|
//debugln('TEditor.IsUnused: Modified = ',DbgS(Modified),', FFileName = "',FFileName,'", Length(Text) = ',DbgS(Length(Text)));
|
||||||
|
Result := (not Modified) and (FFileName = EmptyStr) and (Length(Text) = 0);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TEditor.SetHighlighterByFileType(const AFileType: TEditorFileType; const Permanent: Boolean = False);
|
procedure TEditor.SetHighlighterByFileType(const AFileType: TEditorFileType; const Permanent: Boolean = False);
|
||||||
begin
|
begin
|
||||||
if Assigned(FEditorPageControl) then
|
if Assigned(FEditorPageControl) then
|
||||||
|
@ -2048,7 +2048,11 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
end;}
|
end;}
|
||||||
Ed := NoteBook.AddPage;
|
//If available, open new file in unused open Tab (if that is the current active one)
|
||||||
|
if (Assigned(NoteBook.CurrentEditor) and (NoteBook.CurrentEditor.IsUnused)) then
|
||||||
|
Ed := NoteBook.CurrentEditor
|
||||||
|
else
|
||||||
|
Ed := NoteBook.AddPage;
|
||||||
if Assigned(Ed) then
|
if Assigned(Ed) then
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
|
Reference in New Issue
Block a user