From ad8c8df569d8705899a50d6f70db1ed39a757b53 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 30 Sep 2018 20:16:51 +0200 Subject: [PATCH] terminal, add option to follow the mini explorer path --- src/ce_term.pas | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ce_term.pas b/src/ce_term.pas index 87064470..c6c6cfd0 100644 --- a/src/ce_term.pas +++ b/src/ce_term.pas @@ -19,6 +19,7 @@ type fSelectedColor: TColor; fFollowEditors: boolean; fFollowProjects: boolean; + fFollowExplorer: boolean; fScrollbackLines: longword; fFont: TFont; procedure setFont(value: TFont); @@ -33,6 +34,7 @@ type property font: TFont read fFont write setFont; property followEditors: boolean read fFollowEditors write fFollowEditors; property followProjects: boolean read fFollowProjects write fFollowProjects; + property followExplorer: boolean read fFollowExplorer write fFollowExplorer; property scrollbackLines: longword read fScrollbackLines write fScrollbackLines default 512; end; @@ -52,7 +54,7 @@ type { TCETermWidget } - TCETermWidget = class(TCEWidget, ICEDocumentObserver, ICEProjectObserver) + TCETermWidget = class(TCEWidget, ICEDocumentObserver, ICEProjectObserver, ICEMiniExplorerObserver) procedure ContentPaint(Sender: TObject); private fTerm: TTerminal; @@ -65,6 +67,8 @@ type procedure docChanged(document: TCESynMemo); procedure docClosing(document: TCESynMemo); + procedure mnexDirectoryChanged(const directory: string); + procedure projNew(project: ICECommonProject); procedure projChanged(project: ICECommonProject); procedure projClosing(project: ICECommonProject); @@ -243,6 +247,16 @@ begin fOpts.applyChanges; end; +procedure TCETermWidget.mnexDirectoryChanged(const directory: string); +begin + if fOpts.followExplorer and directory.dirExists and + not SameText(directory, fLastCd) then + begin + fLastCd := directory; + fTerm.Command('cd ' + directory); + end; +end; + procedure TCETermWidget.docNew(document: TCESynMemo); begin end;