Add some logging about keyboard focus.
This should help with debugging #218 if it occurs again.
This commit is contained in:
parent
8d22d558e2
commit
eb5527f897
@ -220,9 +220,11 @@ class ModeManager(QObject):
|
|||||||
if curmode != usertypes.KeyMode.insert:
|
if curmode != usertypes.KeyMode.insert:
|
||||||
log.modes.debug("handled: {}, forward-unbound-keys: {}, "
|
log.modes.debug("handled: {}, forward-unbound-keys: {}, "
|
||||||
"passthrough: {}, is_non_alnum: {} --> filter: "
|
"passthrough: {}, is_non_alnum: {} --> filter: "
|
||||||
"{}".format(handled, self._forward_unbound_keys,
|
"{} (focused: {!r})".format(
|
||||||
|
handled, self._forward_unbound_keys,
|
||||||
curmode in self.passthrough,
|
curmode in self.passthrough,
|
||||||
is_non_alnum, filter_this))
|
is_non_alnum, filter_this,
|
||||||
|
QApplication.instance().focusWidget()))
|
||||||
return filter_this
|
return filter_this
|
||||||
|
|
||||||
def _eventFilter_keyrelease(self, event):
|
def _eventFilter_keyrelease(self, event):
|
||||||
|
@ -215,7 +215,7 @@ class MainWindow(QWidget):
|
|||||||
cmd.got_cmd.connect(self._commandrunner.run_safely)
|
cmd.got_cmd.connect(self._commandrunner.run_safely)
|
||||||
cmd.got_search.connect(search_runner.search)
|
cmd.got_search.connect(search_runner.search)
|
||||||
cmd.got_search_rev.connect(search_runner.search_rev)
|
cmd.got_search_rev.connect(search_runner.search_rev)
|
||||||
cmd.returnPressed.connect(tabs.setFocus)
|
cmd.returnPressed.connect(tabs.on_cmd_return_pressed)
|
||||||
search_runner.do_search.connect(tabs.search)
|
search_runner.do_search.connect(tabs.search)
|
||||||
tabs.got_cmd.connect(self._commandrunner.run_safely)
|
tabs.got_cmd.connect(self._commandrunner.run_safely)
|
||||||
|
|
||||||
|
@ -153,6 +153,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
|||||||
# won't change, so we make sure we emit update_completion.
|
# won't change, so we make sure we emit update_completion.
|
||||||
self.update_completion.emit(self.prefix(), self.split(),
|
self.update_completion.emit(self.prefix(), self.split(),
|
||||||
self._cursor_part)
|
self._cursor_part)
|
||||||
|
log.modes.debug("Setting command text, focusing {!r}".format(self))
|
||||||
self.setFocus()
|
self.setFocus()
|
||||||
self.show_cmd.emit()
|
self.show_cmd.emit()
|
||||||
|
|
||||||
@ -212,6 +213,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
|||||||
text += ' '
|
text += ' '
|
||||||
self.setText(text)
|
self.setText(text)
|
||||||
log.completion.debug("Placing cursor after '{}'".format(cursor_str))
|
log.completion.debug("Placing cursor after '{}'".format(cursor_str))
|
||||||
|
log.modes.debug("Completion triggered, focusing {!r}".format(self))
|
||||||
self.setCursorPosition(len(cursor_str))
|
self.setCursorPosition(len(cursor_str))
|
||||||
self.setFocus()
|
self.setFocus()
|
||||||
self.show_cmd.emit()
|
self.show_cmd.emit()
|
||||||
|
@ -162,6 +162,8 @@ class Prompter(QObject):
|
|||||||
mode = usertypes.KeyMode.prompt
|
mode = usertypes.KeyMode.prompt
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid prompt mode!")
|
raise ValueError("Invalid prompt mode!")
|
||||||
|
log.modes.debug("Question asked, focusing {!r}".format(
|
||||||
|
prompt.lineedit))
|
||||||
prompt.lineedit.setFocus()
|
prompt.lineedit.setFocus()
|
||||||
self.show_prompt.emit()
|
self.show_prompt.emit()
|
||||||
self._busy = True
|
self._busy = True
|
||||||
|
@ -497,6 +497,7 @@ class TabbedBrowser(tabwidget.TabWidget):
|
|||||||
"""Give focus to current tab if command mode was left."""
|
"""Give focus to current tab if command mode was left."""
|
||||||
if mode == usertypes.KeyMode.command:
|
if mode == usertypes.KeyMode.command:
|
||||||
widget = self.currentWidget()
|
widget = self.currentWidget()
|
||||||
|
log.modes.debug("Left command mode, focusing {!r}".format(widget))
|
||||||
if widget is None:
|
if widget is None:
|
||||||
return
|
return
|
||||||
widget.setFocus()
|
widget.setFocus()
|
||||||
@ -508,6 +509,7 @@ class TabbedBrowser(tabwidget.TabWidget):
|
|||||||
# closing the last tab (before quitting)
|
# closing the last tab (before quitting)
|
||||||
return
|
return
|
||||||
tab = self.widget(idx)
|
tab = self.widget(idx)
|
||||||
|
log.modes.debug("Current tab changed, focusing {!r}".format(tab))
|
||||||
tab.setFocus()
|
tab.setFocus()
|
||||||
modeman.maybe_leave(self._win_id, usertypes.KeyMode.hint,
|
modeman.maybe_leave(self._win_id, usertypes.KeyMode.hint,
|
||||||
'tab changed')
|
'tab changed')
|
||||||
@ -520,6 +522,11 @@ class TabbedBrowser(tabwidget.TabWidget):
|
|||||||
self._tab_insert_idx_left = self.currentIndex()
|
self._tab_insert_idx_left = self.currentIndex()
|
||||||
self._tab_insert_idx_right = self.currentIndex() + 1
|
self._tab_insert_idx_right = self.currentIndex() + 1
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def on_cmd_return_pressed(self):
|
||||||
|
"""Set focus when the commandline closes."""
|
||||||
|
log.modes.debug("Commandline closed, focusing {!r}".format(self))
|
||||||
|
|
||||||
def on_load_progress(self, tab, perc):
|
def on_load_progress(self, tab, perc):
|
||||||
"""Adjust tab indicator on load progress."""
|
"""Adjust tab indicator on load progress."""
|
||||||
try:
|
try:
|
||||||
|
@ -328,6 +328,7 @@ class WebView(QWebView):
|
|||||||
@pyqtSlot('QMouseEvent')
|
@pyqtSlot('QMouseEvent')
|
||||||
def on_mouse_event(self, evt):
|
def on_mouse_event(self, evt):
|
||||||
"""Post a new mouseevent from a hintmanager."""
|
"""Post a new mouseevent from a hintmanager."""
|
||||||
|
log.modes.debug("Hint triggered, focusing {!r}".format(self))
|
||||||
self.setFocus()
|
self.setFocus()
|
||||||
QApplication.postEvent(self, evt)
|
QApplication.postEvent(self, evt)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user