changeset 25566:eee01a6e197f

allow setting a breakpoint in an unnamed editor file (bug #54231) * file-editor-tab.cc (unchanged_or_saved): also ask for saving the file if it is not modified but unnamed; (handle_request_remove_breakpoint): add breakpoint when unchanged or saved
author Torsten <mttl@mailbox.org>
date Mon, 09 Jul 2018 22:16:34 +0200
parents a461dedb833f
children e6b037514f56
files libgui/src/m-editor/file-editor-tab.cc
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Mon Jul 09 13:11:33 2018 -0700
+++ b/libgui/src/m-editor/file-editor-tab.cc	Mon Jul 09 22:16:34 2018 +0200
@@ -480,10 +480,10 @@
   bool file_editor_tab::unchanged_or_saved (void)
   {
     bool retval = true;
-    if (_edit_area->isModified ())
+    if (_edit_area->isModified () || ! valid_file_name ())
       {
         int ans = QMessageBox::question (nullptr, tr ("Octave Editor"),
-                                         tr ("Cannot add breakpoint to modified file.\n"
+                                         tr ("Cannot add breakpoint to modified or unnamed file.\n"
                                              "Save and add breakpoint, or cancel?"),
                                          QMessageBox::Save | QMessageBox::Cancel, QMessageBox::Save);
 
@@ -519,7 +519,7 @@
               handle_request_remove_breakpoint (editor_linenr + 1);
             else
               {
-                if (unchanged_or_saved () && valid_file_name ())
+                if (unchanged_or_saved ())
                   handle_request_add_breakpoint (editor_linenr + 1, "");
               }
           }