Refocus command prompt after a new tab is opened when in command mode
This commit is contained in:
parent
95093b82c9
commit
71d55e9213
@ -22,7 +22,7 @@
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
from PyQt5.QtWidgets import QSizePolicy, QWidget
|
from PyQt5.QtWidgets import QSizePolicy, QWidget, QApplication
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QTimer, QUrl
|
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QTimer, QUrl
|
||||||
from PyQt5.QtGui import QIcon
|
from PyQt5.QtGui import QIcon
|
||||||
|
|
||||||
@ -458,6 +458,8 @@ class TabbedBrowser(QWidget):
|
|||||||
"related {}, idx {}".format(
|
"related {}, idx {}".format(
|
||||||
url, background, related, idx))
|
url, background, related, idx))
|
||||||
|
|
||||||
|
prev_focus = QApplication.focusWidget()
|
||||||
|
|
||||||
if (config.val.tabs.tabs_are_windows and self.widget.count() > 0 and
|
if (config.val.tabs.tabs_are_windows and self.widget.count() > 0 and
|
||||||
not ignore_tabs_are_windows):
|
not ignore_tabs_are_windows):
|
||||||
window = mainwindow.MainWindow(private=self.private)
|
window = mainwindow.MainWindow(private=self.private)
|
||||||
@ -494,6 +496,13 @@ class TabbedBrowser(QWidget):
|
|||||||
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076
|
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076
|
||||||
tab.setFocus()
|
tab.setFocus()
|
||||||
|
|
||||||
|
mode = modeman.instance(self._win_id).mode
|
||||||
|
if mode in [usertypes.KeyMode.command, usertypes.KeyMode.prompt,
|
||||||
|
usertypes.KeyMode.yesno]:
|
||||||
|
# If we were in a command prompt, restore old focus
|
||||||
|
# The above commands need to be run to switch tabs
|
||||||
|
prev_focus.setFocus()
|
||||||
|
|
||||||
tab.show()
|
tab.show()
|
||||||
self.new_tab.emit(tab, idx)
|
self.new_tab.emit(tab, idx)
|
||||||
return tab
|
return tab
|
||||||
|
@ -1272,3 +1272,19 @@ Feature: Tab management
|
|||||||
And I run :enter-mode insert
|
And I run :enter-mode insert
|
||||||
And I run :fake-key -g new
|
And I run :fake-key -g new
|
||||||
Then the javascript message "contents: existingnew" should be logged
|
Then the javascript message "contents: existingnew" should be logged
|
||||||
|
|
||||||
|
Scenario: Focused prompt after opening link in bg
|
||||||
|
When I open data/hints/link_input.html
|
||||||
|
When I run :set-cmd-text -s :message-info
|
||||||
|
And I open data/hello.txt in a new background tab
|
||||||
|
And I run :fake-key -g hello-world
|
||||||
|
And I run :command-accept
|
||||||
|
Then the message "hello-world" should be shown
|
||||||
|
|
||||||
|
Scenario: Focused prompt after opening link in fg
|
||||||
|
When I open data/hints/link_input.html
|
||||||
|
When I run :set-cmd-text -s :message-info
|
||||||
|
And I open data/hello.txt in a new tab
|
||||||
|
And I run :fake-key -g hello-world
|
||||||
|
And I run :command-accept
|
||||||
|
Then the message "hello-world" should be shown
|
||||||
|
Loading…
Reference in New Issue
Block a user