From bd3c2f92fc9f07748d502c21429b5376deb5fddf Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Fri, 20 Jan 2017 19:32:16 +0100 Subject: [PATCH 1/2] Blacklist some modes for :enter-mode This disallows using :enter-mode with modes that don't work properly when entered that way. Fixes #1137. --- qutebrowser/keyinput/modeman.py | 4 ++++ tests/end2end/features/misc.feature | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index d86b4996f..eb4baf7f5 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -265,6 +265,10 @@ class ModeManager(QObject): m = usertypes.KeyMode[mode] except KeyError: raise cmdexc.CommandError("Mode {} does not exist!".format(mode)) + if m in [usertypes.KeyMode.hint, usertypes.KeyMode.command, + usertypes.KeyMode.yesno, usertypes.KeyMode.prompt]: + raise cmdexc.CommandError( + "Mode {} can't be entered manually!".format(mode)) self.enter(m, 'command') @pyqtSlot(usertypes.KeyMode, str, bool) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 143988c64..67767f0df 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -642,3 +642,9 @@ Feature: Various utility commands. And I run :command-accept And I set general -> private-browsing to false Then the message "blah" should be shown + + ## Modes blacklisted for :enter-mode + + Scenario: Trying to enter command mode with :enter-mode + When I run :enter-mode command + Then the error "Mode command can't be entered manually!" should be shown From 97feef03fdfe55b4399296b304aafbf90748ded6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 4 Feb 2017 17:52:50 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 4d9cbfdb9..193673f6b 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -36,6 +36,7 @@ Fixed - Worked around a segfault with Qt 5.8 when closing a tab with a search active - Fixed various mouse actions (like automatically entering insert mode) not working with Qt 5.8 - Fixed hints sometimes not working with Qt 5.8 +- `:enter-mode` now refuses to enter modes which can't be entered manually (which caused crashes). v0.9.1 ------