Handle Shift-Return keypresses correctly.
This commit is contained in:
parent
c0a88bf3d0
commit
e163478782
@ -705,6 +705,7 @@ DATA = collections.OrderedDict([
|
|||||||
('<Tab>', 'completion-item-next'),
|
('<Tab>', 'completion-item-next'),
|
||||||
('<Down>', 'completion-item-next'),
|
('<Down>', 'completion-item-next'),
|
||||||
('<Return>', 'command-accept'),
|
('<Return>', 'command-accept'),
|
||||||
|
('<Shift-Return>', 'command-accept'),
|
||||||
('<Ctrl-B>', 'rl-backward-char'),
|
('<Ctrl-B>', 'rl-backward-char'),
|
||||||
('<Ctrl-F>', 'rl-forward-char'),
|
('<Ctrl-F>', 'rl-forward-char'),
|
||||||
('<Alt-B>', 'rl-backward-word'),
|
('<Alt-B>', 'rl-backward-word'),
|
||||||
@ -726,6 +727,7 @@ DATA = collections.OrderedDict([
|
|||||||
typ.KeyBindingName(), typ.KeyBinding(),
|
typ.KeyBindingName(), typ.KeyBinding(),
|
||||||
('<Escape>', 'leave-mode'),
|
('<Escape>', 'leave-mode'),
|
||||||
('<Return>', 'prompt-accept'),
|
('<Return>', 'prompt-accept'),
|
||||||
|
('<Shift-Return>', 'prompt-accept'),
|
||||||
('y', 'prompt-yes'),
|
('y', 'prompt-yes'),
|
||||||
('n', 'prompt-no'),
|
('n', 'prompt-no'),
|
||||||
('<Ctrl-B>', 'rl-backward-char'),
|
('<Ctrl-B>', 'rl-backward-char'),
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
"""The commandline in the statusbar."""
|
"""The commandline in the statusbar."""
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt
|
||||||
from PyQt5.QtWidgets import QSizePolicy, QApplication
|
from PyQt5.QtWidgets import QSizePolicy, QApplication
|
||||||
|
|
||||||
from qutebrowser.keyinput import modeman, modeparsers
|
from qutebrowser.keyinput import modeman, modeparsers
|
||||||
@ -305,3 +305,16 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
|||||||
raise AssertionError("setText got called with invalid text "
|
raise AssertionError("setText got called with invalid text "
|
||||||
"'{}'!".format(text))
|
"'{}'!".format(text))
|
||||||
super().setText(text)
|
super().setText(text)
|
||||||
|
|
||||||
|
def keyPressEvent(self, e):
|
||||||
|
"""Override keyPressEvent to ignore Return key presses.
|
||||||
|
|
||||||
|
If this widget is focused, we are in passthrough key mode, and
|
||||||
|
Enter/Shift+Enter/etc. will cause QLineEdit to think it's finished
|
||||||
|
without command_accept to be called.
|
||||||
|
"""
|
||||||
|
if e.key() == Qt.Key_Return:
|
||||||
|
e.ignore()
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
super().keyPressEvent(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user