Comment #4 on issue 184 by sunyin51: unable to middle mouse click to close the inactive file
http://code.google.com/p/ulipad/issues/detail?id=184

This is the code that perfects the page focus after middle mouse. I.E. when middle mouse clicked on the inactive tab, that tab will be closed, but the focus stays at
the active page, no switch.

Index: EditorFactory.py
===================================================================
--- EditorFactory.py    (revision 511)
+++ EditorFactory.py    (working copy)
@@ -343,16 +343,20 @@
         except:
             return
         self.callplugin('beforeclosefile', self, document)
+        selected = self.GetSelection()
         self.skip_closing = True
         self.skip_page_change = True
         self.DeletePage(index)
-        if index >= len(self.getDocuments()):
-            index = len(self.getDocuments())-1
-        if index >= 0:
-            self.switch(self.getDoc(index))
-        else:
-            self.new()
-        self.document.SetFocus()
+        #if the page to close is not selected, no need to switch page
+        if index == selected:
+            if index > 0:
+                if index >= len(self.getDocuments()):
+                    index = len(self.getDocuments())-1
+                # only swith page when there is a page to switch to
+                self.switch(self.getDoc(index))
+            else:
+              self.new()
+            self.document.SetFocus()
         self.callplugin('afterclosefile', self)

     def savefile(self, document, filename, encoding):

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply via email to