diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py index c627098ed..63b95e2fa 100644 --- a/qutebrowser/mainwindow/prompt.py +++ b/qutebrowser/mainwindow/prompt.py @@ -170,6 +170,8 @@ class PromptQueue(QObject): log.prompt.debug("New question is blocking, saving {}".format( self._question)) old_question = self._question + if old_question is not None: + old_question.interrupted = True self._question = question self.show_prompts.emit(question) @@ -184,7 +186,6 @@ class PromptQueue(QObject): loop.exec_() log.prompt.debug("Ending loop.exec_() for {}".format(question)) - # FIXME don't we end up connecting modeman signals twice here now? log.prompt.debug("Restoring old question {}".format(old_question)) self._question = old_question self.show_prompts.emit(old_question) @@ -294,9 +295,11 @@ class PromptContainer(QWidget): log.prompt.debug("Displaying prompt {}".format(prompt)) self._prompt = prompt - question.aborted.connect( - lambda: modeman.maybe_leave(self._win_id, prompt.KEY_MODE, - 'aborted')) + if not question.interrupted: + # If this question was interrupted, we already connected the signal + question.aborted.connect( + lambda: modeman.maybe_leave(self._win_id, prompt.KEY_MODE, + 'aborted')) modeman.enter(self._win_id, prompt.KEY_MODE, 'question asked') self.setSizePolicy(prompt.sizePolicy()) diff --git a/qutebrowser/utils/usertypes.py b/qutebrowser/utils/usertypes.py index 71517136c..40ec1c4a6 100644 --- a/qutebrowser/utils/usertypes.py +++ b/qutebrowser/utils/usertypes.py @@ -339,6 +339,7 @@ class Question(QObject): text: The prompt text to display to the user. answer: The value the user entered (as password for user_pwd). is_aborted: Whether the question was aborted. + interrupted: Whether the question was interrupted by another one. Signals: answered: Emitted when the question has been answered by the user. @@ -368,6 +369,7 @@ class Question(QObject): self.text = None self.answer = None self.is_aborted = False + self.interrupted = False def __repr__(self): return utils.get_repr(self, title=self.title, text=self.text,