Commits

Yuya Nishihara committed 9cb78e1

chunks, fileview: delay force-display until mouse release (fixes #2427)

setText() while mouse press causes unwanted text selection. It can be avoided
by using indicatorReleased or SCN_INDICATORRELEASE.

This patch uses SCN_INDICATORRELEASE because,
- indicatorReleased isn't available in older version
- indicatorReleased cannot be queued because of argument type
QObject::connect: Cannot queue arguments of type 'Qt::KeyboardModifiers'
(Make sure 'Qt::KeyboardModifiers' is registered using qRegisterMetaType().)

Tested compatibility with Ubuntu 10.10.

Comments (0)

Files changed (2)

tortoisehg/hgqt/chunks.py

             self.sci.setIndicatorDrawUnder(True, self._forceviewindicator)
             self.sci.setIndicatorForegroundColor(
                 QColor('blue'), self._forceviewindicator)
-            self.sci.indicatorClicked.connect(self.forceDisplayFile)
+            # delay until next event-loop in order to complete mouse release
+            self.sci.SCN_INDICATORRELEASE.connect(self.forceDisplayFile,
+                                                  Qt.QueuedConnection)
 
     def forceDisplayFile(self):
         if self.curchunks:

tortoisehg/hgqt/fileview.py

             self.sci.setIndicatorDrawUnder(True, self._forceviewindicator)
             self.sci.setIndicatorForegroundColor(
                 QColor('blue'), self._forceviewindicator)
-            if hasattr(self.sci, 'indicatorClicked'):
-                self.sci.indicatorClicked.connect(self.forceDisplayFile)
-            else:
-                # for older QScintilla versions, we do not care the arguments
-                # are different
-                self.sci.SCN_INDICATORCLICK.connect(self.forceDisplayFile)
+            # delay until next event-loop in order to complete mouse release
+            self.sci.SCN_INDICATORRELEASE.connect(self.forceDisplayFile,
+                                                  Qt.QueuedConnection)
 
     def forceDisplayFile(self):
         if self.changes is not None: