changeset 33411:f64d8e86b0fc stable

gui: Allow executing new files from built-in editor with F5 (bug #65548). * libgui/src/main-window.cc (main_window::run_file_in_terminal): Rehash load path before executing file.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 15 Apr 2024 16:37:08 +0200
parents abce1aa7f66f
children ada37b7a4b28 ec8b3c32effa
files libgui/src/main-window.cc
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Mon Apr 15 13:44:26 2024 +0200
+++ b/libgui/src/main-window.cc	Mon Apr 15 16:37:08 2024 +0200
@@ -1167,6 +1167,13 @@
 
            load_path& lp = interp.get_load_path ();
 
+           // Rehashing the load path is only needed when executing new files
+           // in the built-in editor for the first time and the command line
+           // prompt hasn't been displayed yet again since this *new* file has
+           // been saved for the first time.
+           // FIXME: Is there a way to detect here that a file is new?
+           lp.rehash ();
+
            std::string path = info.absolutePath ().toStdString ();
 
            if (lp.contains_file_in_dir (file_path, path))