From b05738dd6ce7aee36df057f90ba9d792037eb45e Mon Sep 17 00:00:00 2001 From: wishfort36 <42300264+wishfort36@users.noreply.github.com> Date: Sun, 12 Aug 2018 22:39:32 +0200 Subject: [PATCH] Keep $QUTE_COUNT unset if a count is not given --- qutebrowser/browser/commands.py | 4 +++- tests/end2end/data/userscripts/hello_if_count | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 5c0e41e77..448741f9f 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1252,9 +1252,11 @@ class CommandDispatcher: env = { 'QUTE_MODE': 'command', 'QUTE_SELECTED_TEXT': selection, - 'QUTE_COUNT': str(count), # must be a string } + if count is not None: + env['QUTE_COUNT'] = str(count) # must be str + idx = self._current_index() if idx != -1: env['QUTE_TITLE'] = self._tabbed_browser.widget.page_title(idx) diff --git a/tests/end2end/data/userscripts/hello_if_count b/tests/end2end/data/userscripts/hello_if_count index 7ba64a76e..efc8bdd6e 100755 --- a/tests/end2end/data/userscripts/hello_if_count +++ b/tests/end2end/data/userscripts/hello_if_count @@ -4,7 +4,7 @@ if [ "$QUTE_COUNT" = "5" ]; then echo "message-info 'Count is five!'" >> "$QUTE_FIFO" -elif [ "$QUTE_COUNT" = "None" ]; then +elif [ -z "$QUTE_COUNT" ]; then echo "message-info 'No count!'" >> "$QUTE_FIFO"