From 688d1d03ecc964a21332234dda240c8babe10f45 Mon Sep 17 00:00:00 2001 From: Luke <11898833+curlpipe@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:26:07 +0100 Subject: [PATCH] fixed issues with cwd changing during opening of files --- plugins/autoindent.lua | 2 +- src/main.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/autoindent.lua b/plugins/autoindent.lua index d84ef21..0d4b0bd 100644 --- a/plugins/autoindent.lua +++ b/plugins/autoindent.lua @@ -203,7 +203,7 @@ function dedent_amount(y) end -- Shortcut to indent a selection -event_mapping["alt_tab"] = function() +event_mapping["ctrl_tab"] = function() local cursor = editor.cursor local select = editor.selection if cursor.y == select.y then diff --git a/src/main.rs b/src/main.rs index 6691099..8e7363a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,7 +86,10 @@ fn run(cli: &CommandLineInterface) -> Result<()> { editor.borrow_mut().config.document.borrow_mut().file_types = file_types; // Open files user has asked to open + let cwd = std::env::current_dir()?; for (c, file) in cli.to_open.iter().enumerate() { + // Reset cwd + let _ = std::env::set_current_dir(&cwd); // Open the file editor.borrow_mut().open_or_new(file.to_string())?; // Set read only if applicable