From a17a54e549874f3a3afebfd59a9dbc45ba00e2ff Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 1 Sep 2016 09:59:21 +0200 Subject: [PATCH] Open Dialog now defaults to the current view's folder if the view is outside of the opened folder --- src/window.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/window.cc b/src/window.cc index 366bec9..79f7f29 100644 --- a/src/window.cc +++ b/src/window.cc @@ -306,7 +306,12 @@ void Window::set_menu_actions() { }); menu.add_action("open_file", [this]() { - auto path=Dialog::open_file(Notebook::get().get_current_folder()); + auto folder_path=Notebook::get().get_current_folder(); + if(auto view=Notebook::get().get_current_view()) { + if(!Directories::get().path.empty() && !filesystem::file_in_path(view->file_path, Directories::get().path)) + folder_path=view->file_path.parent_path(); + } + auto path=Dialog::open_file(folder_path); if(path!="") Notebook::get().open(path); });