From 0e18acbde5a3246d35decf95b7f76fcbf80283bd Mon Sep 17 00:00:00 2001 From: Jovan Gerodetti Date: Tue, 24 Jan 2023 20:23:17 +0100 Subject: [PATCH] send user HOME dir from proxy to editor (#2056) * send user HOME dir from proxy to editor * update changelog --- CHANGELOG.md | 1 + lapce-proxy/src/dispatch.rs | 7 +++++++ lapce-rpc/src/core.rs | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 071d6534..fec005b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - [#1939](https://github.com/lapce/lapce/pull/1939): Fix saving/editing newly saved-as files - [#1971](https://github.com/lapce/lapce/pull/1971): Fix up/down movement on first/last line - [#2036](https://github.com/lapce/lapce/pull/2036): Fix movement on selections with up/down arrow keys +- [#2056](https://github.com/lapce/lapce/pull/2056): Fix default directory of remote session file picker ## 0.2.5 diff --git a/lapce-proxy/src/dispatch.rs b/lapce-proxy/src/dispatch.rs index de731b3c..7f9d56c6 100644 --- a/lapce-proxy/src/dispatch.rs +++ b/lapce-proxy/src/dispatch.rs @@ -95,6 +95,13 @@ fn handle_notification(&mut self, rpc: ProxyNotification) { plugin_rpc.mainloop(&mut plugin); }); self.core_rpc.proxy_connected(); + + // send home directory for initinal filepicker dir + let dirs = directories::UserDirs::new(); + + if let Some(dirs) = dirs { + self.core_rpc.home_dir(dirs.home_dir().into()); + } } OpenPaths { folders, files } => { self.core_rpc.notification(CoreNotification::OpenPaths { diff --git a/lapce-rpc/src/core.rs b/lapce-rpc/src/core.rs index 8f8eb499..d542a099 100644 --- a/lapce-rpc/src/core.rs +++ b/lapce-rpc/src/core.rs @@ -300,6 +300,10 @@ pub fn close_terminal(&self, term_id: TermId) { pub fn update_terminal(&self, term_id: TermId, content: Vec) { self.notification(CoreNotification::UpdateTerminal { term_id, content }); } + + pub fn home_dir(&self, path: PathBuf) { + self.notification(CoreNotification::HomeDir { path }); + } } impl Default for CoreRpcHandler {