Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit 29cddcd

Browse files
committed
bugfix: modules are correctly reloaded on save
1 parent 031958e commit 29cddcd

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/window.cc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -391,26 +391,26 @@ void Window::set_menu_actions() {
391391
Notebook::get().get_view(c)->configure();
392392
Notebook::get().configure(c);
393393
}
394-
if(view->file_path.extension().string()==".py"){
395-
auto file_path=view->file_path;
396-
while(file_path.has_parent_path()){
397-
auto parent=file_path.parent_path();
398-
if(parent==Config::get().python.plugin_directory){
399-
auto stem=file_path.stem().string();
400-
auto module=Python::get_loaded_module(stem);
401-
module=module ? Python::reload(module) : Python::import(stem);
402-
if(module)
403-
Terminal::get().print("Plugin `"+stem+"` was reloaded\n");
404-
else {
405-
if(Python::thrown_exception_matches(PyExc_SyntaxError))
406-
Terminal::get().print(Python::SyntaxError());
407-
else
408-
Terminal::get().print(Python::Error());
409-
}
410-
break;
394+
}
395+
if(view->file_path.extension().string()==".py"){
396+
auto file_path=view->file_path;
397+
while(file_path.has_parent_path()){
398+
auto parent=file_path.parent_path();
399+
if(parent==Config::get().python.plugin_directory){
400+
auto stem=file_path.stem().string();
401+
auto module=Python::get_loaded_module(stem);
402+
module=module ? Python::reload(module) : Python::import(stem);
403+
if(module)
404+
Terminal::get().print("Plugin `"+stem+"` was reloaded\n");
405+
else {
406+
if(Python::thrown_exception_matches(PyExc_SyntaxError))
407+
Terminal::get().print(Python::SyntaxError());
408+
else
409+
Terminal::get().print(Python::Error());
411410
}
412-
file_path=parent;
411+
break;
413412
}
413+
file_path=parent;
414414
}
415415
}
416416
}

0 commit comments

Comments
 (0)