changeset 21650:7c0595c722ca

Remove duplicate menu actions after replacing <unnamed> edit tab (bug #47692). * file-editor-tab.cc (file_editor::request_open_file): Suppress call to add_file_editor_tab when reusing a tab.
author Lachlan Andrew <lachlanbis@gmail.com>
date Thu, 14 Apr 2016 15:27:45 +1000
parents 0822917dfcf5
children b4354327d2b5
files libgui/src/m-editor/file-editor.cc
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Wed Apr 27 17:17:00 2016 -0400
+++ b/libgui/src/m-editor/file-editor.cc	Thu Apr 14 15:27:45 2016 +1000
@@ -457,12 +457,15 @@
         {
           file_editor_tab *fileEditorTab = 0;
           // Reuse <unnamed> tab if it hasn't yet been modified.
+          bool reusing = false;
           tab = find_tab_widget ("");
           if (tab)
             {
               fileEditorTab = static_cast<file_editor_tab *>(tab);
               if (fileEditorTab->qsci_edit_area ()->isModified ())
                 fileEditorTab = 0;
+              else
+                reusing = true;
             }
 
           // If <unnamed> was absent or modified, create a new tab.
@@ -477,7 +480,8 @@
                 {
                   // Supply empty title then have the file_editor_tab update
                   // with full or short name.
-                  add_file_editor_tab (fileEditorTab, "");
+                  if (!reusing)
+                    add_file_editor_tab (fileEditorTab, "");
                   fileEditorTab->update_window_title (false);
                   // file already loaded, add file to mru list here
                   QFileInfo file_info = QFileInfo (openFileName);