Bug 137179 - 'close icon' closes wrong tab in split view
Summary: 'close icon' closes wrong tab in split view
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-11 01:24 UTC by Matthew Woehlke
Modified: 2006-12-21 01:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Woehlke 2006-11-11 01:24:11 UTC
Version:           3.3.9x (svn sync 2006-11-10) (using KDE KDE 3.5.5)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.4.3 20050227 (Red Hat 3.4.3-22.1) 
OS:                Linux

When clicking the 'close' icon on the file tab bar, the first-opened file is closed, rather than the active one.

PRECONDITIONS:
'Enable Split of Header/Source Files' in Project Options->C++ Support->Navigation turned on.
An opened project with a .cpp and .h, neither of which is currently open, that will open in split-mode.

STEPS TO REPRODUCE:
1. Open the .cpp
   - new tab with the .cpp is created, tab caption is "<foo>.cpp"
2. Open the .h
   - Single tab now splits into two, tab caption is "<foo>.h"
3. Click tab 'close' button

ACTUAL RESULT:
<foo>.cpp closes, leaving only <foo>.h open.

EXPECTED RESULT:
File that is active (i.e. has its name in the tab caption, i.e. 
"<foo>.h") is closed.
Comment 1 Jens Dagerbo 2006-12-06 10:08:43 UTC
What UI mode are you in? (Settings->Configure KDevelop->UI Mode) It might be relevant.
Comment 2 András Manţia 2006-12-06 11:12:25 UTC
Tested with IDEAL mode, KDE & KDevelop from svn, it works fine. If I'm on the C++ file, it closes the C++, if I'm inside the other part of the split view (the .h file), it closes that one.
Comment 3 Matthew Woehlke 2006-12-06 16:46:43 UTC
Simplified IDEAL, using KDevelop 3.3.93 svn synced yesterday, I can still reproduce. C++ Support settings (Navigation) are: 'enable split'=yes 'auto sync'=yes, Orientation=Horizontal (this didn't seem to make a difference), and in Context Menu, 'Switch ...'=yes, 'Show Go To ...'=no, 'Show type ...'=yes. Turning off 'auto sync' didn't help, and I wouldn't expect any of the context menu stuff to have any effect.
Comment 4 Jens Dagerbo 2006-12-16 20:41:17 UTC
Can't reproduce in RC2.
Comment 5 Matthew Woehlke 2006-12-20 19:54:13 UTC
Hmm, just checked again in SVN (as of last week, I think, but more recently than RC2); no change. Anything suggestions on tracking this down? Might it be a problem in KATE?
Comment 6 Jens Dagerbo 2006-12-20 21:40:21 UTC
Yes, you're right. It still exists.
Comment 7 Jens Dagerbo 2006-12-20 22:11:36 UTC
SVN commit 615262 by dagerbo:

Handle closing of multibuffers

BUG: 137179

 M  +11 -1     simplemainwindow.cpp  


--- branches/kdevelop/3.4/src/simplemainwindow.cpp #615261:615262
@@ -54,6 +54,7 @@
 #include "toplevel.h"
 #include "projectmanager.h"
 #include "editorproxy.h"
+#include "multibuffer.h"
 
 SimpleMainWindow::SimpleMainWindow(QWidget* parent, const char *name)
     :DMainWindow(parent, name)
@@ -847,7 +848,16 @@
         QWidget *widget = EditorProxy::getInstance()->topWidgetForPart(part);
         if (widget && widget == w)
         {
-            PartController::getInstance()->closePart(part);
+            // weirdness beyond weirdness.. sometimes the active view is an embedded splitter with two files
+            // so we check if the widget is a multibuffer, in which case we let it decide what part to close
+            if (MultiBuffer * mb = dynamic_cast<MultiBuffer*>( widget ) )
+            {
+                PartController::getInstance()->closePart( mb->activeBuffer() );
+            }
+            else
+            {
+                PartController::getInstance()->closePart(part);
+            }
             return;
         }
         ++it;
Comment 8 Matthew Woehlke 2006-12-21 01:04:21 UTC
Confirming that that fixed it. Thanks, Jens!