Merge remote-tracking branch 'origin/pr/3592'

This commit is contained in:
Florian Bruhin 2018-02-21 10:13:26 +01:00
commit 8b09003bd1
3 changed files with 7 additions and 4 deletions

View File

@ -342,7 +342,7 @@ class AbstractCaret(QObject):
def _on_mode_entered(self, mode):
raise NotImplementedError
def _on_mode_left(self):
def _on_mode_left(self, mode):
raise NotImplementedError
def move_to_next_line(self, count=1):

View File

@ -223,7 +223,10 @@ class WebEngineCaret(browsertab.AbstractCaret):
self._js_call('setInitialCursor')
@pyqtSlot(usertypes.KeyMode)
def _on_mode_left(self):
def _on_mode_left(self, mode):
if mode != usertypes.KeyMode.caret:
return
self.drop_selection()
self._js_call('disableCaret')

View File

@ -205,8 +205,8 @@ class WebKitCaret(browsertab.AbstractCaret):
self._widget.page().currentFrame().evaluateJavaScript(
utils.read_file('javascript/position_caret.js'))
@pyqtSlot()
def _on_mode_left(self):
@pyqtSlot(usertypes.KeyMode)
def _on_mode_left(self, _mode):
settings = self._widget.settings()
if settings.testAttribute(QWebSettings.CaretBrowsingEnabled):
if self.selection_enabled and self._widget.hasSelection():